Skip to content
instance method

Net::HTTPHeader#content_type

() -> (nil | ::String)
content_type

Returns the media type from the value of field 'Content-Type', or nil if no such field exists; see Content-Type response header:

Example
res = Net::HTTP.get_response(hostname, '/todos/1')
res['content-type'] # => "application/json; charset=utf-8"
res.content_type    # => "application/json"