Skip to content

Commit f923121

Browse files
authored
set content type header only if required (#49)
Do not set a request content type for GET and HEAD requests. fixes #47
1 parent 00fc01f commit f923121

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/client.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ end
206206

207207
set_header_content_type(ctx::Ctx, ctypes::Vector{T}) where {T} = set_header_content_type(ctx, convert(Vector{String}, ctypes))
208208
function set_header_content_type(ctx::Ctx, ctypes::Vector{String})
209-
ctx.header["Content-Type"] = select_header_content_type(ctypes)
209+
if !(ctx.method in ("GET", "HEAD"))
210+
ctx.header["Content-Type"] = select_header_content_type(ctypes)
211+
end
210212
return nothing
211213
end
212214

0 commit comments

Comments
 (0)