lib/ezclient/request.rb in ezclient-0.15.0 vs lib/ezclient/request.rb in ezclient-0.15.1

- old
+ new

@@ -149,17 +149,23 @@ headers = HTTP::Headers.coerce(headers) headers[:user_agent] ||= "ezclient/#{EzClient::VERSION}" headers end - def prepare_form_params(params) - params.transform_values do |value| - if value.is_a?(File) - HTTP::FormData::File.new(value) - else - value - end + def prepare_form_params(original_params) + params = {} + + # NOTE: use Hash#transform_values after Ruby 2.3 support is dropped + original_params.each do |key, value| + params[key] = + if value.is_a?(File) + HTTP::FormData::File.new(value) + else + value + end end + + params end def set_timeout(client) return client unless timeout