def uri
return request.uri unless request.uri.is_a?(String)
uri_matchers = match_attributes.to_a & [:uri, :host, :path]
case set(uri_matchers)
when set then /.*/
when set(:uri) then request.uri
when set(:host) then VCR::Regexes.url_regex_for_hosts([URI(request.uri).host])
when set(:path) then VCR::Regexes.url_regex_for_path(URI(request.uri).path)
when set(:host, :path)
uri = URI(request.uri)
VCR::Regexes.url_regex_for_host_and_path(uri.host, uri.path)
else raise ArgumentError.new("match_attributes cannot include #{uri_matchers.join(' and ')}")
end
end