Method: HTTPX::ContentType#mime_type

Defined in:
lib/httpx/response.rb

#mime_typeObject

returns the mime type declared in the header.

ContentType.new("application/json; charset=utf-8").mime_type #=> "application/json"


219
220
221
222
223
224
# File 'lib/httpx/response.rb', line 219

def mime_type
  return @mime_type if defined?(@mime_type)

  m = @header_value.to_s[MIME_TYPE_RE, 1]
  m && @mime_type = m.strip.downcase
end