Sha256: dd1233ccf4c06e2b38e6f5fe7cfc1baef8a38607b233390a87380da1ff1bc032
Contents?: true
Size: 666 Bytes
Versions: 8
Compression:
Stored size: 666 Bytes
Contents
module Faraday class Response::ActiveSupportJson < Response::Middleware begin if !defined?(ActiveSupport::JSON) require 'active_support' ActiveSupport::JSON end def self.register_on_complete(env) env[:response].on_complete do |finished_env| finished_env[:body] = parse(finished_env[:body]) end end rescue LoadError, NameError => e self.load_error = e end def initialize(app) super @parser = nil end def self.parse(body) ActiveSupport::JSON.decode(body) rescue Object => err raise Faraday::Error::ParsingError.new(err) end end end
Version data entries
8 entries across 8 versions & 1 rubygems