method
content_type
v6.0.0 -
Show latest stable
- Class:
ActionDispatch::Response
content_type()public
Content type of response.
# File actionpack/lib/action_dispatch/http/response.rb, line 247
def content_type
if self.class.return_only_media_type_on_content_type
ActiveSupport::Deprecation.warn(
"Rails 6.1 will return Content-Type header without modification." " If you want just the MIME type, please use `#media_type` instead."
)
content_type = super
content_type ? content_type.split(/;\s*charset=/)[0].presence : content_type
else
super.presence
end
end Related methods
- Instance methods
- abort
- await_commit
- await_sent
- body
- body=
- body_parts
- charset
- charset=
- close
- code
- commit!
- committed?
- content_type
- content_type=
- cookies
- delete_header
- each
- get_header
- has_header?
- media_type
- message
- prepare!
- reset_body!
- response_code
- send_file
- sending!
- sending?
- sending_file=
- sent!
- sent?
- set_header
- status=
- status_message
- to_a
- write
- Class methods
- create
- merge_default_headers
- new
- Private methods
-
assign_default_content_type_and_charset! -
before_committed -
before_sending -
build_buffer -
handle_no_content! -
munge_body_object -
parse_content_type -
parsed_content_type_header -
rack_response -
set_content_type