Class: Increase::Middleware::ParseJson
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Increase::Middleware::ParseJson
- Defined in:
- lib/increase/middleware/parse_json.rb
Overview
JSON response middleware for Faraday 1.0 In Faraday 2.0, the JSON middleware is bundled with the Faraday gem itself
This middleware is from github.com/jsmestad/jsonapi-consumer/blob/7d9721ea7feb888ea1e43edb9f1c0c38334762ed/lib/jsonapi/consumer/middleware/parse_json.rb
Instance Method Summary collapse
Instance Method Details
#call(environment) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/increase/middleware/parse_json.rb', line 14 def call(environment) @app.call(environment).on_complete do |env| if process_response_type?(response_type(env)) env[:raw_body] = env[:body] env[:body] = parse(env[:body]) end end end |