git.iko.soy/typeable/servant
on master help sign in
Add comment about what the bug was. Make ReqBodyState strict.
commit726848b8a3e58bc92172bc1bedd7e9d72d2b9b8c authorJulian K. Arni <jkarni@gmail.com> dateSat 3 Jan 2015, 18:16 (12 years ago) parentecb1da0
1 file changed+5−2
src/Servant/Server/Internal.hs+5−2
src/Servant/Server/Internal.hs+5−2
@@ -27,12 +27,15 @@ import Servant.API
2727import Servant.Common.Text
2828
2929data ReqBodyState = Uncalled
30− | Called B.ByteString
31− | Done B.ByteString
30+ | Called !B.ByteString
31+ | Done !B.ByteString
3232
3333toApplication :: RoutingApplication -> Application
3434toApplication ra request respond = do
3535 reqBodyRef <- newIORef Uncalled
36+ -- We need to check the requestBody possibly more than once, so instead
37+ -- of consuming it entirely once, we cycle through it.
38+ -- See https://github.com/haskell-servant/servant/issues/3
3639 let memoReqBody = do
3740 ior <- readIORef reqBodyRef
3841 case ior of