Sha256: e4a0a484a2d91fa25cb366abfb75e7f238c21d753d8959d403892a92c31aa986
Contents?: true
Size: 786 Bytes
Versions: 13
Compression:
Stored size: 786 Bytes
Contents
# frozen_string_literal: true # To load ActiveSupport::IsolatedExecutionState on activesupport 7. # https://github.com/r7kamura/weneedfeed/issues/19 require 'active_support' require 'active_support/core_ext/array/conversions' require 'active_support/core_ext/hash/conversions' require 'faraday' require 'faraday_middleware/response_middleware' require 'json' module Weneedfeed class FaradayResponseMiddleware < ::FaradayMiddleware::ResponseMiddleware define_parser do |body, options| options ||= {} options = { dasherize: false }.merge(options) object = ::JSON.parse(body) object.to_xml(options) end # @note Overriding. def parse_response?(env) env.response.headers['Content-Type'].to_s.include?('application/json') end end end
Version data entries
13 entries across 13 versions & 1 rubygems