Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix failure with HTTPClient.get_content #130

Merged
merged 1 commit into from Sep 6, 2011
Jump to file or symbol
Failed to load files and symbols.
+10 −1
Split
@@ -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
@@ -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)