Skip to content

Commit

Permalink
bblimke#1089 Raise error if connect is not allowed for httprb
Browse files Browse the repository at this point in the history
  • Loading branch information
debian committed Jan 5, 2025
1 parent 9ff63ac commit 3a5316b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/webmock/http_lib_adapters/http_rb/webmock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,13 @@ def raise_timeout_error
end

def perform
return unless ::WebMock.net_connect_allowed?(request_signature.uri)
response = @perform.call
invoke_callbacks(response.to_webmock, real_request: true)
response
if ::WebMock.net_connect_allowed?(request_signature.uri)
response = @perform.call
invoke_callbacks(response.to_webmock, real_request: true)
response
else
raise ::WebMock::NetConnectNotAllowedError.new request_signature
end
end

def halt
Expand Down

0 comments on commit 3a5316b

Please sign in to comment.