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 DataKinds #-}
|
||||||
{-# LANGUAGE FlexibleContexts #-}
|
{-# LANGUAGE FlexibleContexts #-}
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
|
@ -160,3 +161,8 @@ instance ReflectMethod method => HasEndpoint (Verb method status cts a) where
|
||||||
|
|
||||||
instance HasEndpoint (Raw) where
|
instance HasEndpoint (Raw) where
|
||||||
getEndpoint _ _ = Just ([],"RAW")
|
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
|
library
|
||||||
exposed-modules: Servant.Ekg
|
exposed-modules: Servant.Ekg
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
build-depends: base >=4.7 && <4.9
|
build-depends: base >=4.7 && < 4.10
|
||||||
, ekg-core
|
, ekg-core
|
||||||
, servant > 0.5 && < 0.8
|
, servant > 0.5 && < 0.9
|
||||||
, http-types
|
, http-types
|
||||||
, text
|
, text
|
||||||
, time
|
, time
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
{-# LANGUAGE DataKinds #-}
|
{-# LANGUAGE DataKinds #-}
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE OverlappingInstances #-}
|
{-# LANGUAGE OverlappingInstances #-}
|
||||||
|
@ -69,7 +70,11 @@ type TestApi =
|
||||||
:<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
|
:<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
|
||||||
|
|
||||||
-- DELETE /greet/:greetid
|
-- DELETE /greet/:greetid
|
||||||
|
#if MIN_VERSION_servant(0,8,0)
|
||||||
|
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
|
||||||
|
#else
|
||||||
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
|
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
|
||||||
|
#endif
|
||||||
|
|
||||||
testApi :: Proxy TestApi
|
testApi :: Proxy TestApi
|
||||||
testApi = Proxy
|
testApi = Proxy
|
||||||
|
@ -89,7 +94,11 @@ server = helloH :<|> postGreetH :<|> deleteGreetH
|
||||||
|
|
||||||
postGreetH = return
|
postGreetH = return
|
||||||
|
|
||||||
|
#if MIN_VERSION_servant(0,8,0)
|
||||||
|
deleteGreetH _ = return NoContent
|
||||||
|
#else
|
||||||
deleteGreetH _ = return ()
|
deleteGreetH _ = return ()
|
||||||
|
#endif
|
||||||
|
|
||||||
-- Turn the server into a WAI app. 'serve' is provided by servant,
|
-- Turn the server into a WAI app. 'serve' is provided by servant,
|
||||||
-- more precisely by the Servant.Server module.
|
-- more precisely by the Servant.Server module.
|
||||||
|
|
Loading…
Reference in a new issue