Skip to content

Commit

Permalink
Fix failure with HTTPClient.get_content
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismcg committed Sep 6, 2011
1 parent 9eea97b commit c36cb3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/webmock/http_lib_adapters/httpclient_adapter.rb
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions spec/acceptance/httpclient/httpclient_spec.rb
Expand Up @@ -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)
Expand Down

0 comments on commit c36cb3f

Please sign in to comment.