Sha256: b701f162098f5a710ae3af14c9df7a9326c15b572e68cd306b8d641a7cd83d01
Contents?: true
Size: 628 Bytes
Versions: 1
Compression:
Stored size: 628 Bytes
Contents
module Faraday class Response::ParseJson < Response::Middleware begin require 'multi_json' rescue LoadError, NameError => error self.load_error = error end def self.register_on_complete(env) env[:response].on_complete do |response| response[:body] = begin case response[:body] when '' nil when 'true' true when 'false' false else ::MultiJson.decode(response[:body]) end end end end def initialize(app) super @parser = nil end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faraday_middleware-0.3.0 | lib/faraday/parse_json.rb |