Method: Monus::Engine::EventMachine#send_http_request

Defined in:
lib/monus/engines/eventmachine.rb

#send_http_request(uri, method: :get, body: nil, connection: nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/monus/engines/eventmachine.rb', line 14

def send_http_request(uri, method: :get, body: nil, connection: nil)
  load_http
  EM.schedule do
    if connection
      connection.setup_request(method, path: uri, keepalive: true)
    else
      EM::HttpRequest.new(uri).send(method)
    end
  end
end