@@ -0,0 +1,25 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+
3+module ResponseHeaderSpec where
4+
5+import Data.ByteString
6+import qualified Network.HTTP.Types as H
7+import Network.Wai.Handler.Warp.ResponseHeader
8+import Test.Hspec
9+
10+spec :: Spec
11+spec = describe "composeHeader" $ do
12+ it "composes a HTTP header" $
13+ composeHeader H.http11 H.ok200 headers `shouldBe` composedHeader
14+
15+headers :: H.ResponseHeaders
16+headers = [
17+ ("Date", "Mon, 13 Aug 2012 04:22:55 GMT")
18+ , ("Content-Lenght", "151")
19+ , ("Server", "Mighttpd/2.5.8")
20+ , ("Last-Modified", "Fri, 22 Jun 2012 01:18:08 GMT")
21+ , ("Content-Type", "text/html")
22+ ]
23+
24+composedHeader :: ByteString
25+composedHeader = "HTTP/1.1 200 OK\r\nDate: Mon, 13 Aug 2012 04:22:55 GMT\r\nContent-Lenght: 151\r\nServer: Mighttpd/2.5.8\r\nLast-Modified: Fri, 22 Jun 2012 01:18:08 GMT\r\nContent-Type: text/html\r\n\r\n"