@@ -20,7 +20,7 @@ import Data.Streaming.Network (bindPortTCP, getSocketTCP, safeRecv)
20import Network.HTTP.Types
20import Network.HTTP.Types
21import Network.Socket
21import Network.Socket
22import Network.Socket.ByteString (sendAll)
22import Network.Socket.ByteString (sendAll)
23−import Network.Wai
23+import Network.Wai hiding (responseHeaders)
24import Network.Wai.Handler.Warp
24import Network.Wai.Handler.Warp
25import System.IO (hFlush, hClose, Handle, IOMode(..))
25import System.IO (hFlush, hClose, Handle, IOMode(..))
26import System.IO.Unsafe (unsafePerformIO)
26import System.IO.Unsafe (unsafePerformIO)
@@ -358,8 +358,8 @@ spec = do
359 withApp defaultSettings app $ \port -> do
359 withApp defaultSettings app $ \port -> do
360 res <- sendGET $ "http://127.0.0.1:" ++ show port
360 res <- sendGET $ "http://127.0.0.1:" ++ show port
361− getHeaderValue HdrServer res `shouldBe` Just "server"
361+ getHeaderValue hServer (responseHeaders res) `shouldBe` Just "server"
362− getHeaderValue HdrDate res `shouldBe` Just "date"
362+ getHeaderValue hDate (responseHeaders res) `shouldBe` Just "date"
364 it "streaming echo #249" $ do
364 it "streaming echo #249" $ do
365 let app req f = f $ responseStream status200 [] $ \write _ -> do
365 let app req f = f $ responseStream status200 [] $ \write _ -> do
@@ -382,7 +382,7 @@ spec = do
382 replicateM_ 4 $ write $ byteString "Hello"
382 replicateM_ 4 $ write $ byteString "Hello"
383 withApp defaultSettings app $ \port -> do
383 withApp defaultSettings app $ \port -> do
384 res <- sendGET $ "http://127.0.0.1:" ++ show port
384 res <- sendGET $ "http://127.0.0.1:" ++ show port
385− rspBody res `shouldBe` "HelloHelloHelloHello"
385+ responseBody res `shouldBe` "HelloHelloHelloHello"
387 describe "head requests" $ do
387 describe "head requests" $ do
388 let fp = "test/head-response"
388 let fp = "test/head-response"
@@ -395,19 +395,19 @@ spec = do
395 _ -> error "invalid path"
395 _ -> error "invalid path"
396 it "builder" $ withApp defaultSettings app $ \port -> do
396 it "builder" $ withApp defaultSettings app $ \port -> do
397 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/builder"]
397 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/builder"]
398− rspBody res `shouldBe` ""
398+ responseBody res `shouldBe` ""
399 it "streaming" $ withApp defaultSettings app $ \port -> do
399 it "streaming" $ withApp defaultSettings app $ \port -> do
400 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/streaming"]
400 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/streaming"]
401− rspBody res `shouldBe` ""
401+ responseBody res `shouldBe` ""
402 it "file, no range" $ withApp defaultSettings app $ \port -> do
402 it "file, no range" $ withApp defaultSettings app $ \port -> do
403 bs <- S.readFile fp
403 bs <- S.readFile fp
404 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/file"]
404 res <- sendHEAD $ concat ["http://127.0.0.1:", show port, "/file"]
405− getHeaderValue HdrContentLength res `shouldBe` Just (show $ S.length bs)
405+ getHeaderValue hContentLength (responseHeaders res) `shouldBe` Just (S8.pack $ show $ S.length bs)
406 it "file, with range" $ withApp defaultSettings app $ \port -> do
406 it "file, with range" $ withApp defaultSettings app $ \port -> do
407 res <- sendHEADwH
407 res <- sendHEADwH
408 (concat ["http://127.0.0.1:", show port, "/file"])
408 (concat ["http://127.0.0.1:", show port, "/file"])
409− [mkHeader HdrRange "bytes=0-1"]
409+ [(hRange, "bytes=0-1")]
410− getHeaderValue HdrContentLength res `shouldBe` Just "2"
410+ getHeaderValue hContentLength (responseHeaders res) `shouldBe` Just "2"
412consumeBody :: IO ByteString -> IO [ByteString]
412consumeBody :: IO ByteString -> IO [ByteString]
413consumeBody body =
413consumeBody body =