mirror of
https://github.com/haskell-servant/servant-ekg.git
synced 2024-11-26 21:19:43 +01:00
compatibility servant 0.9
This commit is contained in:
parent
9d7fe71bf6
commit
c99f3005c8
2 changed files with 7 additions and 1 deletions
|
@ -19,7 +19,7 @@ library
|
||||||
hs-source-dirs: lib
|
hs-source-dirs: lib
|
||||||
build-depends: base >=4.7 && < 4.10
|
build-depends: base >=4.7 && < 4.10
|
||||||
, ekg-core
|
, ekg-core
|
||||||
, servant > 0.5 && < 0.9
|
, servant > 0.5 && < 0.10
|
||||||
, http-types
|
, http-types
|
||||||
, text
|
, text
|
||||||
, time
|
, time
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
module Servant.EkgSpec (spec) where
|
module Servant.EkgSpec (spec) where
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
#if !MIN_VERSION_servant(0,9,0)
|
||||||
import Control.Monad.Trans.Except
|
import Control.Monad.Trans.Except
|
||||||
|
#endif
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
|
@ -40,7 +42,11 @@ spec = describe "servant-ekg" $ do
|
||||||
it "collects number of request" $ do
|
it "collects number of request" $ do
|
||||||
withApp $ \port mvar -> do
|
withApp $ \port mvar -> do
|
||||||
mgr <- newManager defaultManagerSettings
|
mgr <- newManager defaultManagerSettings
|
||||||
|
#if MIN_VERSION_servant(0,9,0)
|
||||||
|
Right _result <- runClientM (getEp "name" Nothing) (ClientEnv mgr (BaseUrl Http "localhost" port ""))
|
||||||
|
#else
|
||||||
_result <- runExceptT $ getEp "name" Nothing mgr (BaseUrl Http "localhost" port "")
|
_result <- runExceptT $ getEp "name" Nothing mgr (BaseUrl Http "localhost" port "")
|
||||||
|
#endif
|
||||||
m <- readMVar mvar
|
m <- readMVar mvar
|
||||||
case H.lookup "hello.:name.GET" m of
|
case H.lookup "hello.:name.GET" m of
|
||||||
Nothing -> fail "Expected some value"
|
Nothing -> fail "Expected some value"
|
||||||
|
|
Loading…
Reference in a new issue