class Faraday::Request::Multipart

def process_params(params, prefix = nil, pieces = nil, &block)

def process_params(params, prefix = nil, pieces = nil, &block)
  params.inject(pieces || []) do |all, (key, value)|
    key = "#{prefix}[#{key}]" if prefix
    case value
    when Array
      values = value.inject([]) { |a,v| a << [nil, v] }
      process_params(values, key, all, &block)
    when Hash
      process_params(value, key, all, &block)
    else
      all << block.call(key, value)
    end
  end
end