Skip to content
Browse files

called start_with_request without a block, because as Net:HTTP's star…

…t method description says, it will open AND close a connection if start is called with a block. In this case Net:HTTP then later tries to close that same connection again if the server's response has "Connection: close" in its header. In that case Net:HTTP will throw an IOError.
  • Loading branch information...
1 parent 4711a0b commit aaa5bf2184f16795e6910f31a5ae29270259d67d @HendrikW HendrikW committed
Showing with 3 additions and 4 deletions.
  1. +3 −4 lib/webmock/http_lib_adapters/net_http.rb
7 lib/webmock/http_lib_adapters/net_http.rb
@@ -87,10 +87,9 @@ def request_with_webmock(request, body = nil, &block)
response = if (started? && !WebMock::Config.instance.net_http_connect_on_start) || !started?
@started = false #otherwise start_with_connect wouldn't execute and connect
- start_with_connect {
- response = request_without_webmock(request, nil)
- }
+ start_with_connect
+ response = request_without_webmock(request, nil)
response = request_without_webmock(request, nil)

0 comments on commit aaa5bf2

Please sign in to comment.
Something went wrong with that request. Please try again.