on master help sign in
Add a test case for when the body starts with whitespace
commitf0bf7d6784359b1bfc93944116b8b63ad457943b authorjay groven <jgroven@lutsendata.com> dateSun 6 Jan 2013, 10:26 (14 years ago) parent424b03e
1 file changed+3
warp/test/RequestSpec.hs+3
warp/test/RequestSpec.hs+3
@@ -15,12 +15,15 @@ spec :: Spec
1515spec = describe "takeHeaders" $ do
1616 it "takes until blank" $
1717 blankSafe >>= (`shouldBe` ["foo", "bar", "baz"])
18+ it "ignored leading whitespace in bodies" $
19+ whiteSafe >>= (`shouldBe` ["foo", "bar", "baz"])
1820 it "throws OverLargeHeader when too many" $
1921 tooMany `shouldThrow` overLargeHeader
2022 it "throws OverLargeHeader when too large" $
2123 tooLarge `shouldThrow` overLargeHeader
2224 where
2325 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
2427 tooMany = runResourceT $ (sourceList $ repeat "f\n") $$ takeHeaders
2528 tooLarge = runResourceT $ (sourceList $ repeat "f") $$ takeHeaders
2629