on master help sign in
haddock
commitef46a82abec0e5b044cf273fc7ebd8089c6b2364 authorMatthias Heinzel <mheinzel@posteo.de> dateSat 15 Feb 2020, 22:30 (7 years ago) parentef79e28
1 file changed+6
wai-extra/Network/Wai/Test.hs+6
wai-extra/Network/Wai/Test.hs+6
@@ -99,6 +99,10 @@ runSession session app = ST.evalStateT (runReaderT session app) initState
9999data SRequest = SRequest
100100 { simpleRequest :: Request
101101 , simpleRequestBody :: L.ByteString
102+ -- ^ Request body that will override the one set in 'simpleRequest'.
103+ --
104+ -- This is usually simpler than setting the body as a stateful IO-action
105+ -- in 'simpleRequest'.
102106 }
103107data SResponse = SResponse
104108 { simpleStatus :: H.Status
@@ -174,6 +178,8 @@ extractSetCookieFromSResponse response = do
174178 (Map.fromList [(Cookie.setCookieName c, c) | c <- newClientCookies ]))
175179 return response
176180
181+-- | Similar to 'request', but allows setting the request body as a plain
182+-- 'L.ByteString'.
177183srequest :: SRequest -> Session SResponse
178184srequest (SRequest req bod) = do
179185 refChunks <- liftIO $ newIORef $ L.toChunks bod