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



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 55

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



78
79
80
# File 'lib/webmock/http_lib_adapters/em_http_request_adapter.rb', line 78

def drop_client
  @clients.shift
end