Class: Faraday::Response::Middleware

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

Overview

Used for simple response middleware.

Direct Known Subclasses

Logger, RaiseError

Instance Attribute Summary

Attributes inherited from Middleware

#app, #options

Attributes included from DependencyLoader

#load_error

Instance Method Summary collapse

Methods inherited from Middleware

#call, #close, #initialize

Methods included from DependencyLoader

#dependency, #inherited, #loaded?, #new

Methods included from MiddlewareRegistry

#fetch_middleware, #load_middleware, #lookup_middleware, #middleware_mutex, #register_middleware, #unregister_middleware

Constructor Details

This class inherits a constructor from Faraday::Middleware

Instance Method Details

#on_complete(env) ⇒ Object

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


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

def on_complete(env)
  return unless respond_to?(:parse, true) && env.parse_body?

  env.body = parse(env.body)
end