Method: ActionDispatch::Http::MimeNegotiation#content_mime_type
- Defined in:
- actionpack/lib/action_dispatch/http/mime_negotiation.rb
#content_mime_type ⇒ Object
The MIME type of the HTTP request, such as [Mime](:xml).
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'actionpack/lib/action_dispatch/http/mime_negotiation.rb', line 24 def content_mime_type fetch_header("action_dispatch.request.content_type") do |k| v = if get_header("CONTENT_TYPE") =~ /^([^,;]*)/ Mime::Type.lookup($1.strip.downcase) else nil end set_header k, v rescue ::Mime::Type::InvalidMimeType => e raise InvalidType, e. end end |