on master help sign in
using withMySocket
commit19ecd74366c81c23ed9162859b82c4e1da1d4c18 authorKazu Yamamoto <kazu@iij.ad.jp> dateWed 10 Jul 2019, 16:51 (7 years ago) parent7639301
1 file changed+4−5
warp/test/RunSpec.hs+4−5
warp/test/RunSpec.hs+4−5
@@ -410,15 +410,14 @@ spec = do
410410 atomically $ modifyTVar countVar (+ 1)
411411 loop
412412 loop
413− withApp defaultSettings app $ \port -> do
414− (sock, _addr) <- getSocketTCP "127.0.0.1" port
415− sendAll sock "POST / HTTP/1.1\r\ntransfer-encoding: chunked\r\n\r\n"
413+ withApp defaultSettings app $ withMySocket $ \ms -> do
414+ msWrite ms "POST / HTTP/1.1\r\ntransfer-encoding: chunked\r\n\r\n"
416415 threadDelay 10000
417− sendAll sock "5\r\nhello\r\n0\r\n\r\n"
416+ msWrite ms "5\r\nhello\r\n0\r\n\r\n"
418417 atomically $ do
419418 count <- readTVar countVar
420419 check $ count >= 1
421− bs <- safeRecv sock 4096
420+ bs <- safeRecv (msSocket ms) 4096 -- must not use msRead
422421 S.takeWhile (/= 13) bs `shouldBe` "HTTP/1.1 200 OK"
423422
424423 it "streaming response with length" $ do