on wai-websockets/3.0.0.7 help sign in
typeable/wai/warp/test/ResponseHeaderSpec.hs
28 lines 886 B history raw
1{-# LANGUAGE OverloadedStrings #-}
3module ResponseHeaderSpec (main, spec) where
5import Data.ByteString
6import qualified Network.HTTP.Types as H
7import Network.Wai.Handler.Warp.ResponseHeader
8import Test.Hspec
10main :: IO ()
11main = hspec spec
13spec :: Spec
14spec = describe "composeHeader" $ do
15 it "composes a HTTP header" $
16 composeHeader H.http11 H.ok200 headers `shouldReturn` composedHeader
18headers :: H.ResponseHeaders
19headers = [
20 ("Date", "Mon, 13 Aug 2012 04:22:55 GMT")
21 , ("Content-Lenght", "151")
22 , ("Server", "Mighttpd/2.5.8")
23 , ("Last-Modified", "Fri, 22 Jun 2012 01:18:08 GMT")
24 , ("Content-Type", "text/html")
25 ]
27composedHeader :: ByteString
28composedHeader = "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"