Class: FaradayMiddleware::ParseOj
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FaradayMiddleware::ParseOj
- Defined in:
- lib/rock_rms/parse_oj.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/rock_rms/parse_oj.rb', line 5 def on_complete(env) if empty_body?(env[:body].strip) env[:body] = nil elsif html_body?(env[:body]) env[:body] = env[:body] else env[:body] = Oj.load(env[:body], mode: :compat) end end |