depot/third_party/nixpkgs/pkgs/build-support/fetchurl/tests.nix
Default email 7e47f3658e Project import generated by Copybara.
GitOrigin-RevId: 1925c603f17fc89f4c8f6bf6f631a802ad85d784
2024-09-26 11:04:55 +00:00

25 lines
553 B
Nix

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