Skip to content

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#sub_type

sub_type

Returns the trailing (‘subtype’) part of 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.sub_type        # => "json"
See also #set_range #to_hash #set_form_data #type_params also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0