class Curl::WebMockCurlEasy

def build_request_signature

def build_request_signature
  method = @webmock_method.to_s.downcase.to_sym
  uri = WebMock::Util::URI.heuristic_parse(self.url)
  uri.path = uri.normalized_path.gsub("[^:]//","/")
  headers = headers_as_hash(self.headers).merge(basic_auth_headers)
  request_body = case method
  when :post, :patch
    self.post_body || @post_body
  when :put
    @put_data
  else
    nil
  end
  if defined?( @on_debug )
    @on_debug.call("Trying 127.0.0.1...\r\n", 0)
    @on_debug.call('Connected to ' + uri.hostname + "\r\n", 0)
    @debug_method = method.upcase
    @debug_path = uri.path
    @debug_host = uri.hostname
    http_request = ["#{@debug_method} #{@debug_path} HTTP/1.1"]
    http_request << "Host: #{uri.hostname}"
    headers.each do |name, value|
      http_request << "#{name}: #{value}"
    end
    @on_debug.call(http_request.join("\r\n") + "\r\n\r\n", 2)
    if request_body
      @on_debug.call(request_body + "\r\n", 4)
      @on_debug.call(
        "upload completely sent off: #{request_body.bytesize}"\
        " out of #{request_body.bytesize} bytes\r\n", 0
      )
    end
  end
  request_signature = WebMock::RequestSignature.new(
    method,
    uri.to_s,
    body: request_body,
    headers: headers
  )
  request_signature
end