rest-client/rest-client — pull request #289 by pospischil (2014-06-03 04:18:29+00:00)
Title: add rest_multi_part_repeated_field, which enables multiple fields of the same name for multipart form uploads

With multipart uploads, the RFC 2388 spec allows multiple fields with the same name (http://www.ietf.org/rfc/rfc2388.txt, see 5.5 Ordered fields and duplicated field names). Because rest-client uses a hash to define the params, it's not possible to transmit data this way.

This commit adds support for multiple fields with the same name as part of a multipart file upload. This is similar to issue #152 (and I'm happy to extend for this case).

To take advantage, pass a param with the name of whatever the duplicate field name is, and then the value of type RestMultiPartRepeateField -- which is just an array, with a special name so that we can detect it:

params = {
name: "Joe",
email: "joe@bloggs.com",
duplicate_field: RestMultiPartRepeatedField.new([1,2,3])
}

This will send the params:
name = Joe
email = joe@bloggs.com
duplicate_field = 1
duplicate_field = 2
duplicate_field = 3