nicksieger/multipart-post — pull request #16 by lukeredpath (2011-11-28 16:54:03+00:00)
Title: Allow CompositeIO objects to be rewound and read again

I ran into an issue writing a request middleware for Faraday, which uses this gem for it's file uploads.

My middleware constructs a HMAC signature and to do this, it needs to read the request body. Unfortunately, having read the CompositeIO to get this data, it is no longer in a readable state by the time the request is sent (as subsequent #read calls return an empty string).

Whilst this is consistent with normal IO objects, IO objects have a #rewind method that can reset the IO so it can be read again. This patch adds a #rewind method which I'm able to use my middleware to leave it readable for the rest of the middleware stack in Faraday.