From b978b8d27f312cc1ee3ef0df519e9ee21c63574b Mon Sep 17 00:00:00 2001 From: Mikkel Christiansen Date: Wed, 29 Mar 2017 21:54:04 +0200 Subject: [PATCH] Add test for HasLink with Header combinator --- servant/test/Servant/Utils/LinksSpec.hs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/servant/test/Servant/Utils/LinksSpec.hs b/servant/test/Servant/Utils/LinksSpec.hs index 6a6bb8dc..457cbc74 100644 --- a/servant/test/Servant/Utils/LinksSpec.hs +++ b/servant/test/Servant/Utils/LinksSpec.hs @@ -26,6 +26,8 @@ type TestApi = :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent :<|> "raw" :> Raw + -- With headers + :<|> "header" :> Get '[JSON] (Headers '[Header "Content-Type" String] NoContent) apiLink :: (IsElem endpoint TestApi, HasLink endpoint) => Proxy endpoint -> MkLink endpoint @@ -66,6 +68,8 @@ spec = describe "Servant.Utils.Links" $ do apiLink (Proxy :: Proxy ("delete" :> Delete '[JSON] NoContent)) `shouldBeLink` "delete" apiLink (Proxy :: Proxy ("raw" :> Raw)) `shouldBeLink` "raw" + it "generates correct links when there is headers" $ do + apiLink (Proxy :: Proxy ("header" :> Get '[JSON] (Headers '[Header "Content-Type" String] NoContent))) `shouldBeLink` "header" -- | -- Before https://github.com/CRogers/should-not-typecheck/issues/5 is fixed,