Class: Faraday::Adapter

Inherits:
Middleware
  • Object
show all
Defined in:
lib/faraday/adapter/libuv.rb

Direct Known Subclasses

Libuv

Defined Under Namespace

Classes: Libuv

Instance Method Summary collapse

Instance Method Details

#perform_request(env, opts) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/faraday/adapter/libuv.rb', line 75

def perform_request(env, opts)
  conn = ::UV::HttpEndpoint.new(env[:url].to_s, opts.merge!(@connection_options))
  resp = conn.request(env[:method].to_s.downcase.to_sym,
    headers: env[:request_headers],
    path: "/#{env[:url].to_s.split('/', 4)[-1]}",
    keepalive: false,
    body: read_body(env)).value

  save_response(env, resp.status.to_i, resp.body, resp) #, resp.reason_phrase)
  nil
rescue Exception => e
  e
end