on master help sign in
Try flushing
commitfffd5f4c769a0b39e1f8c5e4d55f7b3eef75f05b authorMichael Snoyman <michael@snoyman.com> dateSun 23 Jun 2013, 15:33 (13 years ago) parentc9a3141
1 file changed+3−1
warp/test/PartialFileSpec.hs+3−1
warp/test/PartialFileSpec.hs+3−1
@@ -12,7 +12,7 @@ import Control.Monad.Trans.Class (lift)
1212import RunSpec (withApp)
1313import Network.HTTP.Types (status200)
1414import Network.Wai
15−import System.IO (hClose)
15+import System.IO (hClose, hFlush)
1616import Network (connectTo, PortID (PortNumber))
1717import Network.Wai.Handler.Warp
1818import Data.Maybe (mapMaybe)
@@ -31,6 +31,7 @@ testRange range out crange = it title $ withApp defaultSettings app $ \port -> d
3131 S.hPutStr handle "Range: bytes="
3232 S.hPutStr handle range
3333 S.hPutStr handle "\r\n\r\n"
34+ hFlush handle
3435 threadDelay 10000
3536 bss <- fmap (lines . filter (/= '\r') . S8.unpack) $ S.hGetSome handle 1024
3637 hClose handle
@@ -53,6 +54,7 @@ testPartial :: Integer -- ^ offset
5354testPartial offset count out = it title $ withApp defaultSettings app $ \port -> do
5455 handle <- connectTo "127.0.0.1" $ PortNumber $ fromIntegral port
5556 S.hPutStr handle "GET / HTTP/1.0\r\n\r\n"
57+ hFlush handle
5658 threadDelay 10000
5759 bss <- fmap (lines . filter (/= '\r') . S8.unpack) $ S.hGetSome handle 1024
5860 hClose handle