1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 11:40:45 +00:00
nixpkgs/pkgs/build-support/fetchurl/tests.nix
2022-11-24 22:32:34 +02:00

14 lines
511 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
'';
};
}