module HTTP
  class Request
    def webmock_signature
      ::WebMock::RequestSignature.new(verb, uri.to_s, {
        headers: headers.to_h,
        body: body
      })
    end
  end
end

module HTTP
  class Request
    def webmock_signature
      request_body = if defined?(HTTP::Request::Body)
                       ''.tap { |string| body.each { |part| string << part } }
                     else
                       body
                     end

      ::WebMock::RequestSignature.new(verb, uri.to_s, {
        headers: headers.to_h,
        body: request_body
      })
    end
  end
end

Make it compatible with the newest http.rb version (3.0.0)
Make it compatible with the newest http.rb version (3.0.0)

http.rb 3.0.0 have introduced HTTP::Request::Body abstraction (
https://github.com/httprb/http/pull/412) - let's make webmock compatible
with it.
