Sha256: 3397803448a5c1c5b52bcd5e943f299930165ca8da868782beb3e1f278809b4f
Contents?: true
Size: 629 Bytes
Versions: 2
Compression:
Stored size: 629 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
faraday_middleware-0.1.7 | lib/faraday/parse_json.rb |
faraday_middleware-0.1.6 | lib/faraday/parse_json.rb |