2024-09-26 11:04:55 +00:00
|
|
|
{
|
|
|
|
testers,
|
|
|
|
fetchurl,
|
|
|
|
jq,
|
|
|
|
moreutils,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
{
|
2022-07-14 12:49:19 +00:00
|
|
|
# Tests that we can send custom headers with spaces in them
|
|
|
|
header =
|
2024-09-26 11:04:55 +00:00
|
|
|
let
|
|
|
|
headerValue = "Test '\" <- These are some quotes";
|
|
|
|
in
|
|
|
|
testers.invalidateFetcherByDrvHash fetchurl {
|
2022-07-14 12:49:19 +00:00
|
|
|
url = "https://httpbin.org/headers";
|
|
|
|
sha256 = builtins.hashString "sha256" (headerValue + "\n");
|
2024-09-26 11:04:55 +00:00
|
|
|
curlOptsList = [
|
|
|
|
"-H"
|
|
|
|
"Hello: ${headerValue}"
|
|
|
|
];
|
2022-07-14 12:49:19 +00:00
|
|
|
postFetch = ''
|
|
|
|
${jq}/bin/jq -r '.headers.Hello' $out | ${moreutils}/bin/sponge $out
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|