Browse Source

Test case for missing/empty Accept-Encoding.

pull/11/head
Fredrik Ekre 2 years ago
parent
commit
864a91695f
  1. 10
      test/runtests.jl

10
test/runtests.jl

@ -646,9 +646,15 @@ end
r_nogzip = HTTP.request( r_nogzip = HTTP.request(
"GET", "http://localhost:8123/metrics/nogzip", ["Accept-Encoding" => enc] "GET", "http://localhost:8123/metrics/nogzip", ["Accept-Encoding" => enc]
) )
@test HTTP.header(r_nogzip, "Content-Encoding") != "gzip" @test HTTP.header(r_nogzip, "Content-Encoding", nothing) === nothing
@test String(r_nogzip.body) == reference_output # HTTP.jl decompresses gzip @test String(r_nogzip.body) == reference_output
end end
# Test missing Accept-Encoding (HTTP.jl adds it automatically unless explicitly set)
r_nogzip = HTTP.request(
"GET", "http://localhost:8123/metrics/default", ["Accept-Encoding" => ""],
)
@test HTTP.header(r_nogzip, "Content-Encoding", nothing) === nothing
@test String(r_nogzip.body) == reference_output
# Clean up # Clean up
close(server) close(server)
wait(server) wait(server)

Loading…
Cancel
Save