Class: Restify::Adapter::EM
- Inherits:
-
Object
- Object
- Restify::Adapter::EM
- Defined in:
- lib/restify/adapter.rb
Defined Under Namespace
Classes: ConnectionPool
Instance Method Summary collapse
Instance Method Details
#call(request) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/restify/adapter.rb', line 10 def call(request) Obligation.create do |w| next_tick do conn = ConnectionPool.get(request.uri) req = conn.send request.method.downcase, keepalive: true, redirects: 3, path: request.uri.normalized_path, query: request.uri.normalized_query, body: request.body, head: request.headers req.callback do w.fulfill Response.new( request, req.response_header.status, req.response_header, req.response ) end req.errback do w.reject RuntimeError.new end end end end |