Module: Evil::Client::Connection
Overview
Object that sends rack-compatible request environment to remote API, and wraps a response into rack-compatible array of [status, headers, body].
Instance Method Summary collapse
-
#call(env) ⇒ Array
Makes the request by taking rack env and returning rack response.
Instance Method Details
#call(env) ⇒ Array
Makes the request by taking rack env and returning rack response
16 17 18 19 20 21 22 23 24 |
# File 'lib/evil/client/connection.rb', line 16 def call(env) request = Rack::Request.new(env) with_logger_for request do open_http_connection_for request do |http| res = http.request build_from(request) [res.code.to_i, Hash(res.header), Array(res.body)] end end end |