1{
2 testers,
3 fetchurl,
4 jq,
5 moreutils,
6 ...
7}:
8{
9 # Tests that we can send custom headers with spaces in them
10 header =
11 let
12 headerValue = "Test '\" <- These are some quotes";
13 in
14 testers.invalidateFetcherByDrvHash fetchurl {
15 url = "https://httpbin.org/headers";
16 sha256 = builtins.hashString "sha256" (headerValue + "\n");
17 curlOptsList = [
18 "-H"
19 "Hello: ${headerValue}"
20 ];
21 postFetch = ''
22 ${jq}/bin/jq -r '.headers.Hello' $out | ${moreutils}/bin/sponge $out
23 '';
24 };
25}