Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix failure with HTTPClient.get_content #130

Merged
merged 1 commit into from

2 participants

@chrismcg

HTTPClient calls r.status in the block in #follow_redirect but WebMock was passing in nil instead of the actual response leading to failure. Passing in response causes the failing test I added to pass and (actually, really this time) works in my app.

@jcf jcf merged commit b1e9953 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2011
  1. @chrismcg
This page is out of date. Refresh to see the latest.
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)
Something went wrong with that request. Please try again.