From 864a91695f7caed4ea4604149878f6126d1c34db Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Tue, 21 Nov 2023 13:38:22 +0100 Subject: [PATCH] Test case for missing/empty Accept-Encoding. --- test/runtests.jl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 3714bfe..b0e086a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -646,9 +646,15 @@ end r_nogzip = HTTP.request( "GET", "http://localhost:8123/metrics/nogzip", ["Accept-Encoding" => enc] ) - @test HTTP.header(r_nogzip, "Content-Encoding") != "gzip" - @test String(r_nogzip.body) == reference_output # HTTP.jl decompresses gzip + @test HTTP.header(r_nogzip, "Content-Encoding", nothing) === nothing + @test String(r_nogzip.body) == reference_output 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 close(server) wait(server)