Skip to content

Commit

Permalink
Make HTTP.rb adapter work with new versions
Browse files Browse the repository at this point in the history
Versions of HTTP.rb that allow access to the Request from the Response (httprb/http#546) require this change to continue working.
  • Loading branch information
joshuaflanagan committed Oct 5, 2019
1 parent e9544e8 commit 2eace84
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/webmock/http_lib_adapters/http_rb/response.rb
Expand Up @@ -11,7 +11,7 @@ def to_webmock
end

class << self
def from_webmock(webmock_response, request_signature = nil)
def from_webmock(webmock_response, request, request_signature = nil)
status = Status.new(webmock_response.status.first)
headers = webmock_response.headers || {}
body = Body.new Streamer.new webmock_response.body
Expand All @@ -24,7 +24,8 @@ def from_webmock(webmock_response, request_signature = nil)
version: "1.1",
headers: headers,
body: body,
uri: uri
uri: uri,
request: request
})
end

Expand Down
2 changes: 1 addition & 1 deletion lib/webmock/http_lib_adapters/http_rb/webmock.rb
Expand Up @@ -38,7 +38,7 @@ def replay
webmock_response.raise_error_if_any

invoke_callbacks(webmock_response, real_request: false)
::HTTP::Response.from_webmock webmock_response, request_signature
::HTTP::Response.from_webmock webmock_response, @request, request_signature
end

def raise_timeout_error
Expand Down

0 comments on commit 2eace84

Please sign in to comment.