compatibility servant 0.9

This commit is contained in:
Martin Heuschober 2017-01-30 03:00:58 +01:00
parent 9d7fe71bf6
commit c99f3005c8
2 changed files with 7 additions and 1 deletions

View File

@ -19,7 +19,7 @@ library
hs-source-dirs: lib
build-depends: base >=4.7 && < 4.10
, ekg-core
, servant > 0.5 && < 0.9
, servant > 0.5 && < 0.10
, http-types
, text
, time

View File

@ -10,7 +10,9 @@
module Servant.EkgSpec (spec) where
import Control.Concurrent
#if !MIN_VERSION_servant(0,9,0)
import Control.Monad.Trans.Except
#endif
import Data.Aeson
import Data.Monoid
import Data.Proxy
@ -40,7 +42,11 @@ spec = describe "servant-ekg" $ do
it "collects number of request" $ do
withApp $ \port mvar -> do
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 "")
#endif
m <- readMVar mvar
case H.lookup "hello.:name.GET" m of
Nothing -> fail "Expected some value"