haskell-servant / servant-snap

Snap port of servant-server (WIP)
Other
28 stars 18 forks source link

Add tests for multiple access of request body #5

Open imalsogreg opened 9 years ago

imalsogreg commented 9 years ago

Snap request bodies are InputStream ByteString (or similar) io-streams, and can't be consumed more than once (same issue as for the warp servant server: https://github.com/haskell-servant/servant/issues/3). This can be fixed by, when a request body is consumed, building a new Request from the old and seeding it with a new io-stream build from the consumed ByteString.

This shouldn't be hard, but we will have to force a size limit on the request body (which we want to be configurable when the server starts, through the normal snap config machinery). We will need to use the request-building functions from an Internal module of snap-core, because this kind of request-monkeying is usually something snap users are supposed to avoid doing.

imalsogreg commented 8 years ago

This should be fixed since I've copied over Delayed routing; but leaving this issue open until I write a test to verify.