Sha256: 490900fc4ca145401a7413d4e510a280db3bd61491974307575e4a0f22a0d9d9
Contents?: true
Size: 689 Bytes
Versions: 12
Compression:
Stored size: 689 Bytes
Contents
module ZendeskAPI # @private module Middleware # @private module Request class EncodeJson < Faraday::Middleware CONTENT_TYPE = 'Content-Type'.freeze MIME_TYPE = 'application/json'.freeze def call(env) type = env[:request_headers][CONTENT_TYPE].to_s type = type.split(';', 2).first if type.index(';') type if env[:body] && !(env[:body].respond_to?(:to_str) && env[:body].empty?) && (type.empty? || type == MIME_TYPE) env[:body] = JSON.dump(env[:body]) env[:request_headers][CONTENT_TYPE] ||= MIME_TYPE end @app.call(env) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems