Sha256: a57bb0ae2bb27b47d974eec7d1d7e3fa6fd215841d2f92dc64d96734d71ffa6e

Contents?: true

Size: 479 Bytes

Versions: 4

Compression:

Stored size: 479 Bytes

Contents

module VCR
  class Response < Struct.new(:status, :headers, :body, :http_version)
    include Normalizers::Header
    include Normalizers::Body

    def self.from_net_http_response(response)
      new(
        ResponseStatus.from_net_http_response(response),
        response.to_hash,
        response.body,
        response.http_version
      )
    end

    def update_content_length_header
      headers['content-length'] &&= [body ? body.length.to_s : '0']
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vcr-1.11.3 lib/vcr/structs/response.rb
vcr-1.11.2 lib/vcr/structs/response.rb
vcr-1.11.1 lib/vcr/structs/response.rb
vcr-1.10.3 lib/vcr/structs/response.rb