mirror of
https://github.com/haskell-servant/servant-ekg.git
synced 2024-11-23 03:29:43 +01:00
compatibility servant 0.8.x
- add HasEndpoint instance for `CaptureAll` - adjust test case for Delete () => NoContent - adjust upper bounds for base & servant
This commit is contained in:
parent
03ac1abd30
commit
9d7fe71bf6
3 changed files with 17 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE FlexibleContexts #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
|
@ -160,3 +161,8 @@ instance ReflectMethod method => HasEndpoint (Verb method status cts a) where
|
|||
|
||||
instance HasEndpoint (Raw) where
|
||||
getEndpoint _ _ = Just ([],"RAW")
|
||||
|
||||
#if MIN_VERSION_servant(0,8,1)
|
||||
instance HasEndpoint (sub :: *) => HasEndpoint (CaptureAll (h :: Symbol) a :> sub) where
|
||||
getEndpoint _ = getEndpoint (Proxy :: Proxy sub)
|
||||
#endif
|
||||
|
|
|
@ -17,9 +17,9 @@ source-repository HEAD
|
|||
library
|
||||
exposed-modules: Servant.Ekg
|
||||
hs-source-dirs: lib
|
||||
build-depends: base >=4.7 && <4.9
|
||||
build-depends: base >=4.7 && < 4.10
|
||||
, ekg-core
|
||||
, servant > 0.5 && < 0.8
|
||||
, servant > 0.5 && < 0.9
|
||||
, http-types
|
||||
, text
|
||||
, time
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{-# LANGUAGE CPP #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE OverlappingInstances #-}
|
||||
|
@ -69,7 +70,11 @@ type TestApi =
|
|||
:<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
|
||||
|
||||
-- DELETE /greet/:greetid
|
||||
#if MIN_VERSION_servant(0,8,0)
|
||||
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
|
||||
#else
|
||||
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
|
||||
#endif
|
||||
|
||||
testApi :: Proxy TestApi
|
||||
testApi = Proxy
|
||||
|
@ -89,7 +94,11 @@ server = helloH :<|> postGreetH :<|> deleteGreetH
|
|||
|
||||
postGreetH = return
|
||||
|
||||
#if MIN_VERSION_servant(0,8,0)
|
||||
deleteGreetH _ = return NoContent
|
||||
#else
|
||||
deleteGreetH _ = return ()
|
||||
#endif
|
||||
|
||||
-- Turn the server into a WAI app. 'serve' is provided by servant,
|
||||
-- more precisely by the Servant.Server module.
|
||||
|
|
Loading…
Reference in a new issue