class Stripe::StripeClient::FaradayStripeEncoder
multipart request, Faraday won’t use the result of this encoder.
hash instead to get a decent representation for logging. In the case of a
When initialized with ‘multipart: true`, the encoder just inspects the
for logging).
parameters twice for every request (once to build the request and once
The class also performs simple caching so that we don’t have to encode
telling Faraday to use that.
We work around the problem by implementing our own simplified encoder and
Faraday ends up stripping out the integer indexes.
– in particular when we send our integer-indexed maps (i.e. arrays),
encoders. I don’t think this process is supposed to be lossy, but it is
reshape anything that we pass to ‘req.params` with one of its default
Used to workaround buggy behavior in Faraday: the library will try to
def decode(_str)
def decode(_str) raise NotImplementedError, "#{self.class.name} does not implement #decode" end
def encode(hash)
This is quite subtle, but for a `multipart/form-data` request Faraday
def encode(hash) @cache.fetch(hash) do |k| @cache[k] = Util.encode_parameters(hash) end end
def initialize
def initialize @cache = {} end