def self.build_request_signature(req)
uri = WebMock::Util::URI.heuristic_parse(req.url)
uri.path = uri.normalized_path.gsub("[^:]//","/")
if req.options[:userpwd]
uri.user, uri.password = req.options[:userpwd].split(':')
end
body = req.options[:body]
if body.is_a?(Hash)
body = WebMock::Util::QueryMapper.values_to_query(body)
end
request_signature = WebMock::RequestSignature.new(
req.options[:method] || :get,
uri.to_s,
:body => body,
:headers => req.options[:headers]
)
req.instance_variable_set(:@__webmock_request_signature, request_signature)
request_signature
end