net-http
net-http copied to clipboard
content-type is set by default even for empty body
Generic request will supply a default content-type of application/x-www-form-urlencoded
- https://github.com/ruby/net-http/blob/a0fab1ab52c52d37d21241a86eba6d958ff1c4db/lib/net/http/generic_request.rb#L299
While this is helpful, this can have negative consequences, and we cannot disable the behavior. In cases where there is no body, or body is set and empty, the content-type is set. In these cases, content-type should not be set at all. It must be set to something to avoid the behavior.
So I'm opening this issue to start discussion. Is it possible that:
- Net::HTTP does not supply default content type for empty body?
- Is it ok to introduce an option on
request
to turn off this behavior? - Net::HTTP default content type is
application/octet-stream
instead ofapplication/x-www-form-urlencoded