Sha256: 97a2cfc84b0e2f6a33a77e764265934bdf8a4e3c22aa48dc5f2c5abf8e700699
Contents?: true
Size: 626 Bytes
Versions: 12
Compression:
Stored size: 626 Bytes
Contents
module ZendeskAPI # @private module Middleware # @private module Response class ParseJson < Faraday::Response::Middleware CONTENT_TYPE = 'Content-Type'.freeze dependency 'json' def on_complete(env) type = env[:response_headers][CONTENT_TYPE].to_s type = type.split(';', 2).first if type.index(';') type if type == 'application/json' && env[:body].respond_to?(:to_str) && !env[:body].strip.empty? env[:body] = JSON.parse(env[:body]) else env[:body] = nil end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems