From b20b8d977046bfa3dad669dbf623488a5b4f6024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Hahn?= Date: Sat, 16 Jan 2016 19:34:44 +0100 Subject: [PATCH] add HasClient instance for HttpVersion --- servant-client/src/Servant/Client.hs | 11 +++++++++++ .../src/Servant/API/Internal/Test/ComprehensiveAPI.hs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/servant-client/src/Servant/Client.hs b/servant-client/src/Servant/Client.hs index e9bab748..bab4f4a2 100644 --- a/servant-client/src/Servant/Client.hs +++ b/servant-client/src/Servant/Client.hs @@ -203,6 +203,17 @@ instance (KnownSymbol sym, ToHttpApiData a, HasClient sublayout) where hname = symbolVal (Proxy :: Proxy sym) +-- | Using a 'HttpVersion' combinator in your API doesn't affect the client +-- functions. +instance HasClient sublayout + => HasClient (HttpVersion :> sublayout) where + + type Client (HttpVersion :> sublayout) = + Client sublayout + + clientWithRoute Proxy = + clientWithRoute (Proxy :: Proxy sublayout) + -- | If you use a 'QueryParam' in one of your endpoints in your API, -- the corresponding querying function will automatically take -- an additional argument of the type specified by your 'QueryParam', diff --git a/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs b/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs index 1e5d9748..465d2885 100644 --- a/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs +++ b/servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs @@ -14,7 +14,7 @@ type ComprehensiveAPI = Get '[JSON] Int :<|> Capture "foo" Int :> GET :<|> Header "foo" Int :> GET :<|> --- HttpVersion :> GET :<|> + HttpVersion :> GET :<|> IsSecure :> GET :<|> QueryParam "foo" Int :> GET :<|> QueryParams "foo" Int :> GET :<|>