Class: Faraday::Response::Middleware

Inherits:
Middleware show all
Defined in:
lib/faraday/response.rb

Direct Known Subclasses

ActiveSupportJson, Nokogiri, Yajl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Middleware

#create_form_params, #full_path_for, #initialize, loaded?, #process_body_for_request, setup_parallel_manager

Constructor Details

This class inherits a constructor from Faraday::Middleware

Class Method Details

.register_on_complete(env) ⇒ Object

Use a response callback in case the request is parallelized.

env[:response].on_complete do |finished_env|
  finished_env[:body] = do_stuff_to(finished_env[:body])
end


12
13
# File 'lib/faraday/response.rb', line 12

def self.register_on_complete(env)
end

Instance Method Details

#call(env) ⇒ Object



15
16
17
18
# File 'lib/faraday/response.rb', line 15

def call(env)
  self.class.register_on_complete(env)
  @app.call env
end