Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed em-http-adapter bug. When a request is made to a URL that retur…

…ns a 3xx response and the :redirects option is set, the globally_stub_request/after_request

hooks are now fired for the original request and the redirect-following request.
  • Loading branch information...
commit 806818f3e87ad9d09acd7aba24ce91de0e8fcc06 1 parent dc0e226
@bblimke bblimke authored
View
6 lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb
@@ -108,14 +108,16 @@ def send_request(head, body)
end
end
- def set_deferred_status(status, *args)
- if status == :succeeded && !stubbed_webmock_response && WebMock::CallbackRegistry.any_callbacks?
+ def unbind(reason = nil)
+ if !stubbed_webmock_response && WebMock::CallbackRegistry.any_callbacks?
webmock_response = build_webmock_response
WebMock::CallbackRegistry.invoke_callbacks(
{:lib => :em_http_request, :real_request => true},
request_signature,
webmock_response)
end
+ @request_signature = nil
+ remove_instance_variable(:@stubbed_webmock_response)
super
end
View
2  spec/acceptance/em_http_request/em_http_request_spec.rb
@@ -36,7 +36,7 @@ def make_request
it 'invokes the after_request hook with both requests' do
urls = []
- WebMock.after_request { |r| urls << r.uri.to_s }
+ WebMock.after_request { |req, res| urls << req.uri.to_s }
make_request
Please sign in to comment.
Something went wrong with that request. Please try again.