1{-# LANGUAGE OverloadedStrings #-}
3module RequestSpec (main, spec) where
6import Data.Conduit.List
7import Network.Wai.Handler.Warp.Request
8import Network.Wai.Handler.Warp.Types
15spec = describe "takeHeaders" $ do
16 it "takes until blank" $
17 blankSafe >>= (`shouldBe` ["foo", "bar", "baz"])
18 it "ignored leading whitespace in bodies" $
19 whiteSafe >>= (`shouldBe` ["foo", "bar", "baz"])
20 it "throws OverLargeHeader when too many" $
21 tooMany `shouldThrow` overLargeHeader
22 it "throws OverLargeHeader when too large" $
23 tooLarge `shouldThrow` overLargeHeader
25 blankSafe = runResourceT $ (sourceList ["f", "oo\n", "bar\nbaz\n\r\n"]) $$ takeHeaders
26 whiteSafe = runResourceT $ (sourceList ["foo\r\nbar\r\nbaz\r\n\r\n hi there"]) $$ takeHeaders
27 tooMany = runResourceT $ (sourceList $ repeat "f\n") $$ takeHeaders
28 tooLarge = runResourceT $ (sourceList $ repeat "f") $$ takeHeaders
30overLargeHeader :: Selector InvalidRequest
31overLargeHeader e = e == OverLargeHeader
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list