git.iko.soy/typeable/servant
on master help sign in
Update reqBodyRef comment.
b433019Julian K. Arni
src/Servant/Server/Internal.hs+5−2
@@ -33,8 +33,11 @@ data ReqBodyState = Uncalled
33toApplication :: RoutingApplication -> Application
33toApplication :: RoutingApplication -> Application
34toApplication ra request respond = do
34toApplication ra request respond = do
35 reqBodyRef <- newIORef Uncalled
35 reqBodyRef <- newIORef Uncalled
36− -- We need to check the requestBody possibly more than once, so instead
36+ -- We may need to consume the requestBody more than once. In order to
37− -- of consuming it entirely once, we cycle through it.
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.
38 -- See https://github.com/haskell-servant/servant/issues/3
41 -- See https://github.com/haskell-servant/servant/issues/3
39 let memoReqBody = do
42 let memoReqBody = do
40 ior <- readIORef reqBodyRef
43 ior <- readIORef reqBodyRef