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/excon_adapter.rb:70

        end

        def self.handle_request(params)
          mock_request  = self.build_request params.dup
          WebMock::RequestRegistry.instance.requested_signatures.put(mock_request)

          if mock_response = WebMock::StubRegistry.instance.response_for_request(mock_request)
            self.perform_callbacks(mock_request, mock_response, real_request: false)
            response = self.real_response(mock_response)
            response
          elsif WebMock.net_connect_allowed?(mock_request.uri)
            conn = new_excon_connection(params)
            real_response = conn.request(request_params_from(params.merge(mock: false)))

            ExconAdapter.perform_callbacks(mock_request, ExconAdapter.mock_response(real_response), real_request: true)

            real_response.data
          else
            raise WebMock::NetConnectNotAllowedError.new(mock_request)
          end
        end

        def self.new_excon_connection(params)
          # Ensure the connection is constructed with the exact same args
          # that the orginal connection was constructed with.
          args = params.fetch(:__construction_args)
          ::Excon::Connection.new(connection_params_from args.merge(mock: false))
        end

        def self.connection_params_from(hash)
          hash = hash.dup
          PARAMS_TO_DELETE.each { |key| hash.delete(key) }
          hash
        end

        def self.request_params_from(hash)
          hash = hash.dup

View on GitHub (pinned to b187df8827)

When it happens

Trigger: Thrown at lib/webmock/http_lib_adapters/excon_adapter.rb:70 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/f9df005aa3d7f2f6. Report an issue: GitHub.