class Faraday::Adapter::HTTPX

  1. lib/httpx/adapters/faraday.rb
Superclass: Adapter

Methods

Public Class

  1. setup_parallel_manager

Public Instance

  1. call

Included modules

  1. RequestMixin

Public Class methods

setup_parallel_manager(options = {})
[show source]
    # File lib/httpx/adapters/faraday.rb
245 def setup_parallel_manager(options = {})
246   ParallelManager.new(options)
247 end

Public Instance methods

call(env)
[show source]
    # File lib/httpx/adapters/faraday.rb
250 def call(env)
251   super
252   if parallel?(env)
253     handler = env[:parallel_manager].enqueue(env)
254     handler.on_response do |response|
255       if response.is_a?(::HTTPX::Response)
256         save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
257           response_headers.merge!(response.headers)
258         end
259       else
260         env[:error] = response.error
261         save_response(env, 0, "", {}, nil)
262       end
263     end
264     return handler
265   end
266 
267   response = connect_and_request(env)
268   save_response(env, response.status, response.body.to_s, response.headers, response.reason) do |response_headers|
269     response_headers.merge!(response.headers)
270   end
271   @app.call(env)
272 end