End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →
instance method
Net::HTTPHeader#content_type=
content_type=(type, params = {})
lib/net/http/header.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.2.0/lib/net/http/header.rb, line 760
def set_content_type(type, params = {})
@header['content-type'] = [type + params.map{|k,v|"; #{k}=#{v}"}.join('')]
end
Alias of #set_content_type
Sets the value of field 'Content-Type'; returns the new value; see Content-Type request header:
Example
req = Net::HTTP::Get.new(uri) req.set_content_type('application/json') # => ["application/json"]
Net::HTTPHeader#content_type= is an alias for Net::HTTPHeader#set_content_type.
See also
#set_content_type
#content_type
#delete
#content_range
also in
4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0