summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordomenkozar <>2019-03-08 04:20:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-03-08 04:20:00 (GMT)
commit58e94aa86849f47a67e9a99393f908bfa787c87b (patch)
tree85392c5cee33eb964b10cb99fc4466abed0f42b7
parentf7d118b20eb72e295215e8e5b83a204e1b82b4ab (diff)
version 0.4.0.0HEAD0.4.0.0master
-rw-r--r--CHANGELOG.md9
-rw-r--r--servant-auth-client.cabal54
-rw-r--r--src/Servant/Auth/Client/Internal.hs20
-rw-r--r--test/Servant/Auth/ClientSpec.hs15
4 files changed, 40 insertions, 58 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e4b31a8..d6024c8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,10 +3,17 @@
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
-and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
+and this project adheres to [PVP Versioning](https://pvp.haskell.org/).
## [Unreleased]
+## [0.4.0.0] - 2019-03-08
+
+## Changed
+
+- #145 Support servant-0.16 in tests @domenkozar
+- #145 Drop GHC 7.10 support @domenkozar
+
## [0.3.3.0] - 2018-06-18
### Added
diff --git a/servant-auth-client.cabal b/servant-auth-client.cabal
index f9c037a..d6c1bcb 100644
--- a/servant-auth-client.cabal
+++ b/servant-auth-client.cabal
@@ -1,5 +1,5 @@
name: servant-auth-client
-version: 0.3.3.0
+version: 0.4.0.0
synopsis: servant-client/servant-auth compatibility
description: This package provides instances that allow generating clients from
<https://hackage.haskell.org/package/servant servant>
@@ -15,7 +15,7 @@ maintainer: jkarni@gmail.com
copyright: (c) Julian K. Arni
license: BSD3
license-file: LICENSE
-tested-with: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2, GHC==8.4.3
+tested-with: GHC == 8.0.2, GHC == 8.2.2, GHC==8.4.4, GHC==8.6.2
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
@@ -25,30 +25,18 @@ source-repository head
type: git
location: https://github.com/haskell-servant/servant-auth
-flag servant-client-core
- description: Use servant-client-core
- default: True
- manual: False
-
library
hs-source-dirs:
src
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
build-depends:
- base >= 4.8 && < 4.12
- , text
- , bytestring
+ base >= 4.9 && < 4.13
+ , bytestring >= 0.10.6.0 && < 0.11
+ , containers >= 0.5.6.2 && < 0.7
, servant-auth == 0.3.*
- , servant >= 0.7 && < 0.15
- if flag(servant-client-core)
- cpp-options: -DHAS_CLIENT_CORE=1
- build-depends:
- servant-client-core >= 0.12 && < 0.15,
- containers
- else
- build-depends:
- servant-client >= 0.7 && < 0.12
+ , servant >= 0.13 && < 0.17
+ , servant-client-core >= 0.13 && < 0.17
exposed-modules:
Servant.Auth.Client
@@ -62,7 +50,7 @@ test-suite spec
test
default-extensions: AutoDeriveTypeable ConstraintKinds DataKinds DefaultSignatures DeriveFoldable DeriveFunctor DeriveGeneric DeriveTraversable FlexibleContexts FlexibleInstances FunctionalDependencies GADTs KindSignatures MultiParamTypeClasses OverloadedStrings RankNTypes ScopedTypeVariables TypeFamilies TypeOperators
ghc-options: -Wall
- build-tool-depends: hspec-discover:hspec-discover
+ build-tool-depends: hspec-discover:hspec-discover >=2.5.5 && <2.8
-- dependencies with bounds inherited from the library stanza
build-depends:
@@ -74,19 +62,19 @@ test-suite spec
-- test dependencies
build-depends:
- hspec > 2 && < 3
- , QuickCheck >= 2.8 && < 2.12
- , aeson
- , bytestring
- , http-client
- , http-types
- , servant-auth-server
- , servant-server
- , time
- , transformers
- , wai
- , warp
- , jose
+ hspec >= 2.5.5 && < 2.8
+ , QuickCheck >= 2.11.3 && < 2.13
+ , aeson >= 1.3.1.1 && < 1.5
+ , bytestring >= 0.10.6.0 && < 0.11
+ , http-client >= 0.5.13.1 && < 0.7
+ , http-types >= 0.12.2 && < 0.13
+ , servant-auth-server >= 0.4.2.0 && < 0.5
+ , servant-server >= 0.13 && < 0.17
+ , time >= 1.5.0.1 && < 1.9
+ , transformers >= 0.4.2.0 && < 0.6
+ , wai >= 3.2.1.2 && < 3.3
+ , warp >= 3.2.25 && < 3.3
+ , jose >= 0.7.0.0 && < 0.9
other-modules:
Servant.Auth.ClientSpec
default-language: Haskell2010
diff --git a/src/Servant/Auth/Client/Internal.hs b/src/Servant/Auth/Client/Internal.hs
index 7d4d6d7..866123d 100644
--- a/src/Servant/Auth/Client/Internal.hs
+++ b/src/Servant/Auth/Client/Internal.hs
@@ -16,14 +16,8 @@ import GHC.Generics (Generic)
import Servant.API ((:>))
import Servant.Auth
-#ifdef HAS_CLIENT_CORE
import Servant.Client.Core
import Data.Sequence ((<|))
-#else
-import Servant.Client
-import Servant.Common.Req (Req (..))
-import qualified Data.Text.Encoding as T
-#endif
-- | A compact JWT Token.
newtype Token = Token { getToken :: BS.ByteString }
@@ -38,7 +32,6 @@ class JWTAuthNotEnabled
-- | @'HasJWT' auths@ is nominally a redundant constraint, but ensures we're not
-- trying to send a token to an API that doesn't accept them.
-#ifdef HAS_CLIENT_CORE
instance (HasJWT auths, HasClient m api) => HasClient m (Auth auths a :> api) where
type Client m (Auth auths a :> api) = Token -> Client m api
@@ -51,16 +44,3 @@ instance (HasJWT auths, HasClient m api) => HasClient m (Auth auths a :> api) wh
#if MIN_VERSION_servant_client_core(0,14,0)
hoistClientMonad pm _ nt cl = hoistClientMonad pm (Proxy :: Proxy api) nt . cl
#endif
-
-#else
-instance (HasJWT auths, HasClient api) => HasClient (Auth auths a :> api) where
- type Client (Auth auths a :> api) = Token -> Client api
-
- clientWithRoute _ req (Token token)
- = clientWithRoute (Proxy :: Proxy api)
- $ req { headers = ("Authorization", headerVal):headers req }
- where
- -- 'servant-client' shouldn't be using a Text here; it should be using a
- -- ByteString.
- headerVal = "Bearer " <> T.decodeLatin1 token
-#endif
diff --git a/test/Servant/Auth/ClientSpec.hs b/test/Servant/Auth/ClientSpec.hs
index 025b247..fdd22ab 100644
--- a/test/Servant/Auth/ClientSpec.hs
+++ b/test/Servant/Auth/ClientSpec.hs
@@ -16,8 +16,10 @@ import Network.HTTP.Types (status401)
import Network.Wai.Handler.Warp (testWithApplication)
import Servant
import Servant.Client (BaseUrl (..), Scheme (Http),
- ServantError (FailureResponse),
-#if MIN_VERSION_servant_client(0,13,0)
+ ClientError (FailureResponse),
+#if MIN_VERSION_servant_client(0,16,0)
+ ResponseF(..),
+#elif MIN_VERSION_servant_client(0,13,0)
GenResponse(..),
#elif MIN_VERSION_servant_client(0,12,0)
Response(..),
@@ -34,6 +36,9 @@ import Servant.Client (ClientEnv (..), runClientM)
#else
import Control.Monad.Trans.Except (runExceptT)
#endif
+#if !MIN_VERSION_servant_server(0,16,0)
+#define ClientError ServantError
+#endif
import Servant.Auth.Client
import Servant.Auth.Server
@@ -67,7 +72,9 @@ hasClientSpec = describe "HasClient" $ around (testWithApplication $ return app)
it "fails when token is expired" $ \port -> property $ \user -> do
tok <- mkTok user (Just past)
-#if MIN_VERSION_servant_client(0,12,0)
+#if MIN_VERSION_servant_client(0,16,0)
+ Left (FailureResponse _ (Response stat _ _ _))
+#elif MIN_VERSION_servant_client(0,12,0)
Left (FailureResponse (Response stat _ _ _))
#elif MIN_VERSION_servant_client(0,11,0)
Left (FailureResponse _ stat _ _)
@@ -78,7 +85,7 @@ hasClientSpec = describe "HasClient" $ around (testWithApplication $ return app)
stat `shouldBe` status401
-getIntClient :: Token -> Manager -> BaseUrl -> IO (Either ServantError Int)
+getIntClient :: Token -> Manager -> BaseUrl -> IO (Either ClientError Int)
#if MIN_VERSION_servant(0,13,0)
getIntClient tok m burl = runClientM (client api tok) (mkClientEnv m burl)
#elif MIN_VERSION_servant(0,9,0)