Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Net::HTTPHeader#content_type=

(::interned type, ?::Hash[untyped, untyped] params) -> void
content_type=(type, params = {})

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.