module VCR::LibraryHooks::WebMock::Helpers

def request_headers_for(webmock_request)

Other tags:
    Private: -
def request_headers_for(webmock_request)
  return nil unless webmock_request.headers
  # WebMock hooks deeply into a Excon at a place where it manually adds a "Host"
  # header, but this isn't a header we actually care to store...
  webmock_request.headers.dup.tap do |headers|
    headers.delete("Host")
  end
end

def request_headers_for(webmock_request)

Other tags:
    Private: -
def request_headers_for(webmock_request)
  webmock_request.headers
end

def typed_request_for(webmock_request, remove = false)

def typed_request_for(webmock_request, remove = false)
  if webmock_request.instance_variables.find { |v| v.to_sym == :@__typed_vcr_request }
    meth = remove ? :remove_instance_variable : :instance_variable_get
    return webmock_request.send(meth, :@__typed_vcr_request)
  end
  warn <<-EOS.gsub(/^\s+\|/, '')
    |WARNING: There appears to be a bug in WebMock's after_request hook
    |         and VCR is attempting to work around it. Some VCR features
    |         may not work properly.
  EOS
  Request::Typed.new(vcr_request_for(webmock_request), :unknown)
end

def vcr_request_for(webmock_request)

def vcr_request_for(webmock_request)
  VCR::Request.new \
    webmock_request.method,
    webmock_request.uri.to_s,
    webmock_request.body,
    request_headers_for(webmock_request)
end

def vcr_response_for(webmock_response)

Other tags:
    Private: -
def vcr_response_for(webmock_response)
  VCR::Response.new \
    VCR::ResponseStatus.new(*webmock_response.status),
    webmock_response.headers,
    webmock_response.body,
    nil
end