Class: EventMachine::WebMockHttpConnection

Inherits:
HttpConnection
  • Object
show all
Defined in:
lib/webmock/http_lib_adapters/em_http_request_adapter.rb

Instance Method Summary collapse

Instance Method Details

#activate_connection(client) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 59

def activate_connection(client)
  request_signature = client.request_signature

  if client.stubbed_webmock_response
    conn = HttpStubConnection.new rand(10000)
    post_init

    @deferred = false
    @conn = conn

    conn.parent = self
    conn.pending_connect_timeout = @connopts.connect_timeout
    conn.comm_inactivity_timeout = @connopts.inactivity_timeout

    finalize_request(client)
    @conn.set_deferred_status :succeeded
  elsif WebMock.net_connect_allowed?(request_signature.uri)
    super
  else
    raise WebMock::NetConnectNotAllowedError.new(request_signature)
  end
end

#drop_clientObject



82
83
84
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 82

def drop_client
  @clients.shift
end