Class VCR::Response
In: lib/vcr/structs.rb
Parent: Struct.new(:status, :headers, :body, :http_version, :adapter_metadata)

The response of an {HTTPInteraction}.

@attr [ResponseStatus] status the status of the response @attr [Hash{String => Array<String>}] headers the response headers @attr [String] body the response body @attr [nil, String] http_version the HTTP version @attr [Hash] adapter_metadata Additional metadata used by a specific VCR adapter.

Methods

Included Modules

Normalizers::Header Normalizers::Body

Constants

HAVE_ZLIB = true
HAVE_ZLIB = false

Public Class methods

Decode string compressed with gzip or deflate

@raise [VCR::Errors::UnknownContentEncodingError] if the content encoding

 is not a known encoding.

Constructs a new instance from a hash.

@param [Hash] hash the hash to use to construct the instance. @return [Response] the response

Public Instance methods

Checks if the type of encoding is one of "gzip" or "deflate".

The type of encoding.

@return [String] encoding type

Decodes the compressed body and deletes evidence that it was ever compressed.

@return self @raise [VCR::Errors::UnknownContentEncodingError] if the content encoding

 is not a known encoding.

Builds a serializable hash from the response data.

@return [Hash] hash that represents this response

 and can be easily serialized.

@see Response.from_hash

Updates the Content-Length response header so that it is accurate for the response body.

[Validate]