@@ -33,8 +33,11 @@ data ReqBodyState = Uncalled
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.
36+ -- We may need to consume the requestBody more than once. In order to
37+ -- maintain the illusion that 'requestBody' works as expected,
38+ -- 'ReqBodyState' is introduced, and the complete body is memoized and
39+ -- returned as many times as requested with empty "Done" marker chunks in
40+ -- between.
3841 -- See https://github.com/haskell-servant/servant/issues/3
3942 let memoReqBody = do
4043 ior <- readIORef reqBodyRef