bblimke/webmock · error · WebMock::NetConnectNotAllowedError

Real HTTP connections are disabled. Unregistered request: #{

Error message

Real HTTP connections are disabled. Unregistered request: #{request_signature}

What it means

Error "Real HTTP connections are disabled. Unregistered request: #{request_signature}" thrown in bblimke/webmock.

Source

Thrown at lib/webmock/http_lib_adapters/patron_adapter.rb:43

              WebMock::HttpLibAdapters::PatronAdapter.
                handle_file_name(req, webmock_response)
              res = WebMock::HttpLibAdapters::PatronAdapter.
                build_patron_response(webmock_response, default_response_charset)
              WebMock::CallbackRegistry.invoke_callbacks(
                {lib: :patron}, request_signature, webmock_response)
              res
            elsif WebMock.net_connect_allowed?(request_signature.uri)
              res = super
              if WebMock::CallbackRegistry.any_callbacks?
                webmock_response = WebMock::HttpLibAdapters::PatronAdapter.
                  build_webmock_response(res)
                WebMock::CallbackRegistry.invoke_callbacks(
                  {lib: :patron, real_request: true}, request_signature,
                    webmock_response)
              end
              res
            else
              raise WebMock::NetConnectNotAllowedError.new(request_signature)
            end
          end
        end

        def self.enable!
          Patron.send(:remove_const, :Session)
          Patron.send(:const_set, :Session, WebMockPatronSession)
        end

        def self.disable!
          Patron.send(:remove_const, :Session)
          Patron.send(:const_set, :Session, OriginalPatronSession)
        end

        def self.handle_file_name(req, webmock_response)
          if req.action == :get && req.file_name
            begin
              File.open(req.file_name, "w") do |f|

View on GitHub (pinned to b187df8827)

When it happens

Trigger: Thrown at lib/webmock/http_lib_adapters/patron_adapter.rb:43 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bblimke/webmock@b187df8827 (2026-08-23). Data as JSON: /api/errors/b17dd3a427efa0a0. Report an issue: GitHub.