summaryrefslogtreecommitdiff
path: root/lib/net/http/generic_request.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2025-02-13 15:52:30 +0900
committergit <[email protected]>2025-06-11 03:35:11 +0000
commit51b70d106ad2fa29f833bde5648738931981d8f4 ()
treea3991756706e5525918f74aef744ae5311a9de4e /lib/net/http/generic_request.rb
parent9b09c68032fc6f30809e33da4b3010a207d2ec95 (diff)
[ruby/net-http] Don't set content type by default
Fixes https://.com/ruby/net-http/issues/205 https://.com/ruby/net-http/commit/002441da1e
-rw-r--r--lib/net/http/generic_request.rb9
1 files changed, 0 insertions, 9 deletions
@@ -260,7 +260,6 @@ class Net::HTTPGenericRequest
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
@@ -271,7 +270,6 @@ class Net::HTTPGenericRequest
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?
@@ -373,12 +371,6 @@ class Net::HTTPGenericRequest
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.
@@ -411,4 +403,3 @@ class Net::HTTPGenericRequest
end
end
-