Skip to content

Commit 2eace84

Browse files
Make HTTP.rb adapter work with new versions
Versions of HTTP.rb that allow access to the Request from the Response (httprb/http#546) require this change to continue working.
1 parent e9544e8 commit 2eace84

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/webmock/http_lib_adapters/http_rb/response.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def to_webmock
1111
end
1212

1313
class << self
14-
def from_webmock(webmock_response, request_signature = nil)
14+
def from_webmock(webmock_response, request, request_signature = nil)
1515
status = Status.new(webmock_response.status.first)
1616
headers = webmock_response.headers || {}
1717
body = Body.new Streamer.new webmock_response.body
@@ -24,7 +24,8 @@ def from_webmock(webmock_response, request_signature = nil)
2424
version: "1.1",
2525
headers: headers,
2626
body: body,
27-
uri: uri
27+
uri: uri,
28+
request: request
2829
})
2930
end
3031

lib/webmock/http_lib_adapters/http_rb/webmock.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def replay
3838
webmock_response.raise_error_if_any
3939

4040
invoke_callbacks(webmock_response, real_request: false)
41-
::HTTP::Response.from_webmock webmock_response, request_signature
41+
::HTTP::Response.from_webmock webmock_response, @request, request_signature
4242
end
4343

4444
def raise_timeout_error

0 commit comments

Comments
 (0)