Skip to content

Commit

Permalink
Switch tests to Raw from RawM since RawM is only in servant 0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
HanStolpo committed Nov 25, 2024
1 parent 5b92288 commit d3be720
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions test/Prometheus/ServantSpec.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Prometheus.ServantSpec (spec) where

import Control.Monad.IO.Class (liftIO)
import Data.Aeson (FromJSON, ToJSON)
import Data.Map.Strict qualified as Map
import Data.Text (Text)
Expand All @@ -23,7 +22,7 @@ import Servant
, Post
, Proxy (..)
, QueryParam
, RawM
, Raw
, ReqBody
, Server
, serve
Expand Down Expand Up @@ -105,7 +104,7 @@ type TestApi =
-- DELETE /greet/:greetid
:<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
-- GET /proxy/some/proxy/route
:<|> "proxy" :> CaptureAll "proxyRoute" Text :> RawM
:<|> "proxy" :> CaptureAll "proxyRoute" Text :> Raw

testApi :: Proxy TestApi
testApi = Proxy
Expand All @@ -127,12 +126,8 @@ server = helloH :<|> postGreetH :<|> deleteGreetH :<|> proxyH

deleteGreetH _ = pure NoContent

proxyH
:: [Text]
-> Wai.Request
-> (Wai.Response -> IO Wai.ResponseReceived)
-> Servant.Handler Wai.ResponseReceived
proxyH _ req responder = liftIO $ responder $ Wai.responseLBS ok200 [] "success"
proxyH :: [Text] -> Servant.Tagged Servant.Handler Wai.Application
proxyH _ = Servant.Tagged $ \_ responder -> responder $ Wai.responseLBS ok200 [] "success"

-- | Turn the server into a WAI app. 'serve' is provided by servant,
-- more precisely by the Servant.Server module.
Expand Down

0 comments on commit d3be720

Please sign in to comment.