diff options
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/response.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/http/response.rb b/actionpack/lib/action_dispatch/http/response.rb index d104dcb8a0..1b12308cc9 100644 --- a/actionpack/lib/action_dispatch/http/response.rb +++ b/actionpack/lib/action_dispatch/http/response.rb @@ -31,6 +31,14 @@ module ActionDispatch # :nodoc: # end # end class Response < Rack::Response + def self.from_response(response) + new.tap do |resp| + resp.status = response.status + resp.headers = response.headers + resp.body = response.body + end + end + DEFAULT_HEADERS = { "Cache-Control" => "no-cache" } attr_accessor :request @@ -80,6 +88,7 @@ module ActionDispatch # :nodoc: def message status.to_s.split(' ',2)[1] || StatusCodes::STATUS_CODES[response_code] end + alias_method :status_message, :message # Was the response successful? def success? |