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

13 lines
492 B
Nix
Raw Normal View History

2024-05-02 00:46:19 +00:00
{ testers, fetchurl, jq, moreutils, ... }: {
# Tests that we can send custom headers with spaces in them
2024-05-13 21:24:10 +00:00
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
'';
};
2024-05-02 00:46:19 +00:00
}