mirror of
https://github.com/ilyakooo0/servant-quickcheck.git
synced 2024-10-05 14:17:37 +03:00
Support servant-server-0.18
This commit is contained in:
parent
7926ad6bdb
commit
e6daf03c16
@ -1,2 +1,4 @@
|
||||
packages: .
|
||||
tests: true
|
||||
|
||||
allow-newer: servant-blaze:servant
|
||||
|
@ -49,9 +49,9 @@ library
|
||||
, pretty >=1.1 && <1.2
|
||||
, process >=1.2 && <1.7
|
||||
, QuickCheck >=2.7 && <2.15
|
||||
, servant >=0.17 && <0.18
|
||||
, servant-client >=0.17 && <0.18
|
||||
, servant-server >=0.17 && <0.18
|
||||
, servant >=0.17 && <0.19
|
||||
, servant-client >=0.17 && <0.19
|
||||
, servant-server >=0.17 && <0.19
|
||||
, split >=0.2 && <0.3
|
||||
, string-conversions >=0.3 && <0.5
|
||||
, temporary >=1.2 && <1.4
|
||||
|
@ -11,6 +11,9 @@ import Network.Wai.Handler.Warp (withApplication)
|
||||
import Prelude.Compat
|
||||
import Servant (Context (EmptyContext), HasServer,
|
||||
Server, serveWithContext)
|
||||
#if MIN_VERSION_servant_server(0,18,0)
|
||||
import Servant (DefaultErrorFormatters, ErrorFormatters, HasContextEntry, type (.++))
|
||||
#endif
|
||||
import Servant.Client (BaseUrl (..), Scheme (..))
|
||||
import System.IO.Unsafe (unsafePerformIO)
|
||||
import Test.Hspec (Expectation, expectationFailure)
|
||||
@ -37,8 +40,13 @@ withServantServer api = withServantServerAndContext api EmptyContext
|
||||
-- application.
|
||||
--
|
||||
-- /Since 0.0.0.0/
|
||||
#if MIN_VERSION_servant_server(0,18,0)
|
||||
withServantServerAndContext :: (HasServer a ctx, HasContextEntry (ctx .++ DefaultErrorFormatters) ErrorFormatters)
|
||||
=> Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
|
||||
#else
|
||||
withServantServerAndContext :: HasServer a ctx
|
||||
=> Proxy a -> Context ctx -> IO (Server a) -> (BaseUrl -> IO r) -> IO r
|
||||
#endif
|
||||
withServantServerAndContext api ctx server t
|
||||
= withApplication (return . serveWithContext api ctx =<< server) $ \port ->
|
||||
t (BaseUrl Http "localhost" port "")
|
||||
|
Loading…
Reference in New Issue
Block a user