method
body=
v8.1.1 -
Show latest stable
- Class:
ActionDispatch::Response
body=(body)public
Allows you to manually set or override the response body.
# File actionpack/lib/action_dispatch/http/response.rb, line 384
def body=(body)
# Prevent ActionController::Metal::Live::Response from committing the response prematurely.
synchronize do
if body.respond_to?(:to_str)
@stream = build_buffer(self, [body])
elsif body.respond_to?(:to_path)
@stream = body
elsif body.respond_to?(:to_ary)
@stream = build_buffer(self, body)
else
@stream = body
end
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?
- location
- location=
- media_type
- message
- prepare!
- redirect_url
- 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
- rack_status_code
- Private methods
-
assign_default_content_type_and_charset! -
before_committed -
before_sending -
build_buffer -
handle_no_content! -
parse_content_type -
parsed_content_type_header -
rack_response -
set_content_type