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