diff --git a/pkgs/build-support/fetchurl/tests.nix b/pkgs/build-support/fetchurl/tests.nix new file mode 100644 index 000000000000..fc7fb25e158f --- /dev/null +++ b/pkgs/build-support/fetchurl/tests.nix @@ -0,0 +1,13 @@ +{ 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 + ''; + }; +} diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 4110327946d9..0e8d5ee0f23b 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -27,6 +27,7 @@ with pkgs; cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; }; cc-multilib-clang = callPackage ./cc-wrapper/multilib.nix { stdenv = clangMultiStdenv; }; + fetchurl = callPackages ../build-support/fetchurl/tests.nix { }; fetchpatch = callPackages ../build-support/fetchpatch/tests.nix { }; fetchgit = callPackages ../build-support/fetchgit/tests.nix { }; fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };