Sha256: 5d5be674c24a30fad43d4684a32dd66521b951c9fba5ecd5482fe2df65846497
Contents?: true
Size: 812 Bytes
Versions: 1
Compression:
Stored size: 812 Bytes
Contents
require 'faraday_middleware/response_middleware' require 'faraday_middleware/request/encode_json' module FaradayMiddleware module ActiveSupport class ParseJson < FaradayMiddleware::ResponseMiddleware dependency 'active_support/json' def parse(body) ::ActiveSupport::JSON.decode(body, @options) rescue body end end class EncodeJson < FaradayMiddleware::EncodeJson dependency 'active_support/json' def initialize(app, *) super(app) end def encode(data) ::ActiveSupport::JSON.encode(data) end end end end Faraday::Response.register_middleware :active_support_json => FaradayMiddleware::ActiveSupport::ParseJson Faraday::Request.register_middleware :active_support_json => FaradayMiddleware::ActiveSupport::EncodeJson
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
faraday_middleware-active_support_json-0.0.2 | lib/faraday_middleware/active_support_json.rb |