Sha256: 101d7b1f08ba316bde9154a29be4fb58b88132f88609a0cc6ea577e1bb0fb799

Contents?: true

Size: 641 Bytes

Versions: 7

Compression:

Stored size: 641 Bytes

Contents

module HTTP
  class Response
    def to_webmock
      webmock_response = ::WebMock::Response.new

      webmock_response.status  = [status.to_i, reason]
      webmock_response.body    = body.to_s
      webmock_response.headers = headers.to_h

      webmock_response
    end

    def self.from_webmock(webmock_response, request_signature = nil)
      status  = Status.new(webmock_response.status.first)
      headers = webmock_response.headers || {}
      body    = Body.new Streamer.new webmock_response.body
      uri     = URI request_signature.uri.to_s if request_signature

      new(status, "1.1", headers, body, uri)
    end
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/webmock-1.21.0/lib/webmock/http_lib_adapters/http_rb/response.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/webmock-1.21.0/lib/webmock/http_lib_adapters/http_rb/response.rb
dwolla_swagger-1.0.6 vendor/bundle/ruby/2.2.0/gems/webmock-1.22.3/lib/webmock/http_lib_adapters/http_rb/response.rb
webmock-1.22.3 lib/webmock/http_lib_adapters/http_rb/response.rb
webmock-1.22.2 lib/webmock/http_lib_adapters/http_rb/response.rb
webmock-1.22.1 lib/webmock/http_lib_adapters/http_rb/response.rb
webmock-1.21.0 lib/webmock/http_lib_adapters/http_rb/response.rb