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
522 B
Nix
Raw Normal View History

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