Class: Faraday::Response::Middleware

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

Direct Known Subclasses

ActiveSupportJson, Yajl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Middleware

#initialize, loaded?, 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