From 29e3c1a45a17c663c8891792743c8057c594ee6a Mon Sep 17 00:00:00 2001 From: "Julian K. Arni" Date: Tue, 21 Jul 2015 15:22:56 +0200 Subject: [PATCH] Fix isElem for Header. The intention was obviously to ignore them, but we weren't doing so correctly. --- servant/CHANGELOG.md | 1 + servant/src/Servant/Utils/Links.hs | 2 +- servant/test/Servant/Utils/LinksSpec.hs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/servant/CHANGELOG.md b/servant/CHANGELOG.md index 9ae7547e..e4f51e8c 100644 --- a/servant/CHANGELOG.md +++ b/servant/CHANGELOG.md @@ -2,6 +2,7 @@ HEAD ---- * Add `HttpVersion`, `IsSecure`, `RemoteHost` and `Vault` combinators +* Fix safeLink, so Header is not in fact required. 0.4.2 ----- diff --git a/servant/src/Servant/Utils/Links.hs b/servant/src/Servant/Utils/Links.hs index 19fdc019..7224ff79 100644 --- a/servant/src/Servant/Utils/Links.hs +++ b/servant/src/Servant/Utils/Links.hs @@ -166,7 +166,7 @@ type family IsElem' a s :: Constraint type family IsElem endpoint api :: Constraint where IsElem e (sa :<|> sb) = Or (IsElem e sa) (IsElem e sb) IsElem (e :> sa) (e :> sb) = IsElem sa sb - IsElem sa (Header x :> sb) = IsElem sa sb + IsElem sa (Header sym x :> sb) = IsElem sa sb IsElem sa (ReqBody y x :> sb) = IsElem sa sb IsElem (Capture z y :> sa) (Capture x y :> sb) = IsElem sa sb diff --git a/servant/test/Servant/Utils/LinksSpec.hs b/servant/test/Servant/Utils/LinksSpec.hs index 16f13925..07aeb051 100644 --- a/servant/test/Servant/Utils/LinksSpec.hs +++ b/servant/test/Servant/Utils/LinksSpec.hs @@ -25,7 +25,7 @@ type TestApi = :<|> "get" :> Get '[JSON] () :<|> "put" :> Put '[JSON] () :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] () - :<|> "delete" :> Header "ponies" :> Delete '[JSON] () + :<|> "delete" :> Header "ponies" String :> Delete '[JSON] () :<|> "raw" :> Raw type TestLink = "hello" :> "hi" :> Get '[JSON] Bool