class Faraday::Response::Middleware

Used for simple response middleware.

Public Instance Methods

call(env) click to toggle source
# File lib/faraday/response.rb, line 10
def call(env)
  @app.call(env).on_complete do |environment|
    on_complete(environment)
  end
end
on_complete(env) click to toggle source

Override this to modify the environment after the response has finished. Calls the `parse` method if defined `parse` method can be defined as private, public and protected

# File lib/faraday/response.rb, line 19
def on_complete(env)
  return unless respond_to?(:parse, true) && env.parse_body?

  env.body = parse(env.body)
end