about summary refs log tree commit diff
path: root/pkgs/build-support/fetchurl/tests.nix
diff options
context:
space:
mode:
authorRobert Hensing <roberth@users.noreply.github.com>2022-06-30 21:10:57 +0200
committerGitHub <noreply@github.com>2022-06-30 21:10:57 +0200
commit1e17bb943e4de2d0d08e910216d1df73ffa78754 (patch)
treefe2736d354e6b8bfb3cb49c9a29bb008bd18bc97 /pkgs/build-support/fetchurl/tests.nix
parentff3d914ad786bf484e04dfaf3990e5d6efaea12b (diff)
parent588439e1311c41a5779877d4d8ef603410b79cd4 (diff)
Merge pull request #164662 from infinisil/fetchurl-curlOpts-list
fetchurl: Allow passing curl options with spaces
Diffstat (limited to 'pkgs/build-support/fetchurl/tests.nix')
-rw-r--r--pkgs/build-support/fetchurl/tests.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/build-support/fetchurl/tests.nix b/pkgs/build-support/fetchurl/tests.nix
new file mode 100644
index 0000000000000..fc7fb25e158ff
--- /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
+      '';
+    };
+}