Class: Redd::Response::ParseJson
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Redd::Response::ParseJson
- Defined in:
- lib/redd/response/parse_json.rb
Overview
Faraday Middleware that parses JSON using OJ, via MultiJson.
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
11 12 13 14 15 |
# File 'lib/redd/response/parse_json.rb', line 11 def on_complete(env) env[:body] = MultiJson.load(env[:body], symbolize_keys: true) rescue MultiJson::ParseError raise JSONError.new(env), env[:body] end |