Class: HTTP::Response
- Inherits:
-
Object
- Object
- HTTP::Response
- Defined in:
- lib/webmock/http_lib_adapters/http_rb/response.rb,
lib/webmock/http_lib_adapters/http_rb/streamer.rb
Defined Under Namespace
Classes: Streamer
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_webmock(webmock_response, request_signature = nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/webmock/http_lib_adapters/http_rb/response.rb', line 14 def 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 = normalize_uri(request_signature && request_signature.uri) return new(status, "1.1", headers, body, uri) if HTTP::VERSION < "1.0.0" new({ status: status, version: "1.1", headers: headers, body: body, uri: uri }) end |
Instance Method Details
#to_webmock ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/webmock/http_lib_adapters/http_rb/response.rb', line 3 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 |