nixpkgs/pkgs/build-support/fetchurl/tests.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
511 B
Nix
Raw Normal View History

2022-11-16 19:52:37 +00:00
{ testers, fetchurl, jq, moreutils, ... }: {
2022-06-30 17:49:54 +00:00
# Tests that we can send custom headers with spaces in them
header =
let headerValue = "Test '\" <- These are some quotes";
2022-11-16 19:52:37 +00:00
in testers.invalidateFetcherByDrvHash fetchurl {
2022-06-30 17:49:54 +00:00
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
'';
};
}