2016-01-05 00:15:24 +01:00
|
|
|
{-# LANGUAGE CPP #-}
|
2015-11-25 10:31:58 +01:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
|
2016-01-05 00:15:24 +01:00
|
|
|
module Servant.Client.PerformRequest.GHCJSSpec where
|
2015-11-25 10:31:58 +01:00
|
|
|
|
|
|
|
import Test.Hspec
|
|
|
|
|
2016-01-05 00:15:24 +01:00
|
|
|
#ifdef __GHCJS__
|
|
|
|
|
|
|
|
import Servant.Client.PerformRequest.GHCJS
|
2015-11-25 10:31:58 +01:00
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = do
|
|
|
|
describe "parseHeaders" $ do
|
|
|
|
it "parses single headers" $ do
|
|
|
|
parseHeaders "key: value" `shouldBe` [("key", "value")]
|
|
|
|
|
|
|
|
it "parses multiple headers" $ do
|
|
|
|
parseHeaders "foo: bar\r\nnext: yay" `shouldBe`
|
|
|
|
[("foo", "bar"), ("next", "yay")]
|
|
|
|
|
|
|
|
it "handles colons in header values correctly" $ do
|
|
|
|
parseHeaders "foo: bar:baz" `shouldBe` [("foo", "bar:baz")]
|
2016-01-05 00:15:24 +01:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
spec :: Spec
|
|
|
|
spec = return ()
|
|
|
|
#endif
|