Sha256: a0a0adec8a89098c655a1c6c6edd8939b4b289eebff8c5ede79eaa2e6b948671

Contents?: true

Size: 634 Bytes

Versions: 8

Compression:

Stored size: 634 Bytes

Contents

# frozen_string_literal: true

module HTTP
  class Request
    def webmock_signature
      request_body = nil

      if defined?(HTTP::Request::Body)
        request_body = String.new
        first_chunk_encoding = nil
        body.each do |part|
          request_body << part
          first_chunk_encoding ||= part.encoding
        end

        request_body.force_encoding(first_chunk_encoding) if first_chunk_encoding
        request_body
      else
        request_body = body
      end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
webmock-3.24.0 lib/webmock/http_lib_adapters/http_rb/request.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/webmock-3.23.1/lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.23.0 lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.22.0 lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.21.2 lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.21.1 lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.21.0 lib/webmock/http_lib_adapters/http_rb/request.rb
webmock-3.20.0 lib/webmock/http_lib_adapters/http_rb/request.rb