Sha256: c60e14896696ed4e52ff9d2b4ddf4ffd81f816b55aa8a1d93c13ca64ca08f17b

Contents?: true

Size: 752 Bytes

Versions: 4

Compression:

Stored size: 752 Bytes

Contents

# frozen_string_literal: true

require "action_dispatch/testing/request_encoder"

module ActionDispatch
  # Integration test methods such as ActionDispatch::Integration::Session#get
  # and ActionDispatch::Integration::Session#post return objects of class
  # TestResponse, which represent the HTTP response results of the requested
  # controller actions.
  #
  # See Response for more information on controller response objects.
  class TestResponse < Response
    def self.from_response(response)
      new response.status, response.headers, response.body
    end

    def parsed_body
      @parsed_body ||= response_parser.call(body)
    end

    def response_parser
      @response_parser ||= RequestEncoder.parser(content_type)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
actionpack-6.0.0.rc1 lib/action_dispatch/testing/test_response.rb
actionpack-6.0.0.beta3 lib/action_dispatch/testing/test_response.rb
actionpack-6.0.0.beta2 lib/action_dispatch/testing/test_response.rb
actionpack-6.0.0.beta1 lib/action_dispatch/testing/test_response.rb