Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix failure with HTTPClient.get_content

  • Loading branch information...
commit c36cb3f94718b980708395a117ba0d688b2a4c0e 1 parent 9eea97b
@chrismcg authored
View
2  lib/webmock/http_lib_adapters/httpclient_adapter.rb
@@ -103,7 +103,7 @@ def build_httpclient_response(webmock_response, stream = false, &block)
raise HTTPClient::TimeoutError if webmock_response.should_timeout
webmock_response.raise_error_if_any
- block.call(nil, body) if block
+ block.call(response, body) if block
response
end
View
9 spec/acceptance/httpclient/httpclient_spec.rb
@@ -37,6 +37,15 @@
include_examples "with WebMock"
end
+ it "should work with get_content" do
+ stub_request(:get, 'www.example.com').to_return(:status => 200, :body => 'test', :headers => {})
+ str = ''
+ HTTPClient.get_content('www.example.com') do |content|
+ str << content
+ end
+ str.should == 'test'
+ end
+
context "Filters" do
class Filter
def filter_request(request)
Please sign in to comment.
Something went wrong with that request. Please try again.