Sha256: 6fa5f0bd0efcd62b9e11dcf9ee1369ba6e1520685b82861813cd1be8fc1ad44c
Contents?: true
Size: 836 Bytes
Versions: 5
Compression:
Stored size: 836 Bytes
Contents
require 'net/http' require 'vcr/extensions/net_http_response' module Net class HTTP def request_with_vcr(request, body = nil, &block) vcr_request = VCR::Request.from_net_http_request(self, request) response = request_without_vcr(request, body) match_attributes = (cass = VCR.current_cassette) ? cass.match_requests_on : VCR::RequestMatcher::DEFAULT_MATCH_ATTRIBUTES if started? && !VCR.http_stubbing_adapter.request_stubbed?(vcr_request, match_attributes) VCR.record_http_interaction VCR::HTTPInteraction.new(vcr_request, VCR::Response.from_net_http_response(response)) response.extend VCR::Net::HTTPResponse # "unwind" the response end yield response if block_given? response end alias request_without_vcr request alias request request_with_vcr end end
Version data entries
5 entries across 5 versions & 1 rubygems