Sha256: a9cad632baaaf681480fbcfde151d2c9bb66f7c095501e45dab4eea2f1952f82
Contents?: true
Size: 641 Bytes
Versions: 7
Compression:
Stored size: 641 Bytes
Contents
# frozen_string_literal: true 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
7 entries across 7 versions & 1 rubygems