Skip to content

Commit

Permalink
Don't set content type by default
Browse files Browse the repository at this point in the history
Fixes #205
  • Loading branch information
hsbt committed Feb 13, 2025
1 parent ae6c43c commit 683d0df
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions lib/net/http/generic_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ def finish
def send_request_with_body(sock, ver, path, body)
self.content_length = body.bytesize
delete 'Transfer-Encoding'
supply_default_content_type
write_header sock, ver, path
wait_for_continue sock, ver if sock.continue_timeout
sock.write body
Expand All @@ -271,7 +270,6 @@ def send_request_with_body_stream(sock, ver, path, f)
raise ArgumentError,
"Content-Length not given and Transfer-Encoding is not `chunked'"
end
supply_default_content_type
write_header sock, ver, path
wait_for_continue sock, ver if sock.continue_timeout
if chunked?
Expand Down Expand Up @@ -373,12 +371,6 @@ def flush_buffer(out, buf, chunked_p)
buf.clear
end

def supply_default_content_type
return if content_type()
warn 'net/http: Content-Type did not set; using application/x-www-form-urlencoded', uplevel: 1 if $VERBOSE
set_content_type 'application/x-www-form-urlencoded'
end

##
# Waits up to the continue timeout for a response from the server provided
# we're speaking HTTP 1.1 and are expecting a 100-continue response.
Expand Down Expand Up @@ -411,4 +403,3 @@ def write_header(sock, ver, path)
end

end

0 comments on commit 683d0df

Please sign in to comment.