Parent

Included Modules

Class/Module Index [+]

Quicksearch

EventMachine::WebMockHttpClient

Public Instance Methods

request_signature() click to toggle source
# File lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb, line 126
def request_signature
  @request_signature ||= build_request_signature
end
send_request(head, body) click to toggle source
Also aliased as: send_request_without_webmock
send_request_with_webmock(head, body) click to toggle source
# File lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb, line 95
def send_request_with_webmock(head, body)
  WebMock::RequestRegistry.instance.requested_signatures.put(request_signature)

  if stubbed_webmock_response
    on_error("WebMock timeout error") if stubbed_webmock_response.should_timeout
    WebMock::CallbackRegistry.invoke_callbacks({:lib => :em_http_request}, request_signature, stubbed_webmock_response)
    EM.next_tick {
      setup(make_raw_response(stubbed_webmock_response), @uri,
            stubbed_webmock_response.should_timeout ? "WebMock timeout error" : nil)
    }
    self
  elsif WebMock.net_connect_allowed?(request_signature.uri)
    send_request_without_webmock(head, body)
    callback {
      if WebMock::CallbackRegistry.any_callbacks?
        webmock_response = build_webmock_response
        WebMock::CallbackRegistry.invoke_callbacks(
          {:lib => :em_http_request, :real_request => true},
          request_signature,
          webmock_response)
      end
    }
    self
  else
    raise WebMock::NetConnectNotAllowedError.new(request_signature)
  end
end
Also aliased as: send_request
send_request_without_webmock(head, body) click to toggle source
Alias for: send_request
setup(response, uri, error = nil) click to toggle source
# File lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb, line 84
def setup(response, uri, error = nil)
  @last_effective_url = @uri = uri
  if error
    on_error(error)
    fail(self)
  else
    @conn.receive_data(response)
    succeed(self)
  end
end
stubbed_webmock_response() click to toggle source
# File lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb, line 130
def stubbed_webmock_response
  unless defined?(@stubbed_webmock_response)
    @stubbed_webmock_response = WebMock::StubRegistry.instance.response_for_request(request_signature)
  end

  @stubbed_webmock_response
end
uri() click to toggle source
# File lib/webmock/http_lib_adapters/em_http_request/em_http_request_1_x.rb, line 80
def uri
  @req.uri
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.