If you're interested in an example that uses rewind, check out https://github.com/intridea/grape/blob/5c785324a071f7eb527683256ad34db70e965830/lib/grape/middleware/formatter.rb#L55

Basically, in Rails the input would get read, and left at the end of the stream. So when Grape was mounted on Rails it would want to re-read that input to get more/better/different data and therefore you had to call rewind.


On Sat, May 24, 2014 at 8:35 AM, Torsten Robitzki <Torsten@robitzki.de> wrote:
Hi Magnus,
 
One word: Middleware.

sorry, I didn't found the old discussions here regarding rewind (maybe a typo in my search phrase). Is there any proposal planned to change the specs to allow a more effective input implementation? 

My first thought was something like an unrewindable_input() function, that provides an input stream that doesn't provide a rewind() interface, but buffers the data read through this interface, so that the original input can still provide this data. If all middleware would be aware of this interface and the final application wouldn't need to rewind(), the input would just have to store the part of the input that have to be processed twice.

Cheers,
Torsten 

--

---
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

dB. | Moscow - Geneva - Seattle - New York
code.dblock.org - @dblockdotorg - artsy.net - github/dblock

--

---
You received this message because you are subscribed to the Google Groups "Rack Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rack-devel+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.