Skip to content

Commit

Permalink
Support ruby http gem v1.0.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
ixti committed Dec 21, 2015
1 parent 12835fc commit d2f1317
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/webmock/http_lib_adapters/http_rb/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,17 @@ 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
uri = URI.parse request_signature.uri.to_s if request_signature

new(status, "1.1", headers, body, 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
end
end

0 comments on commit d2f1317

Please sign in to comment.