@@ -47,7 +47,7 @@ import Servant.API ((:<|>) (..), (:>), AuthProtect,
47 Raw, RemoteHost, ReqBody,
47 Raw, RemoteHost, ReqBody,
48 StdMethod (..), Verb, addHeader)
48 StdMethod (..), Verb, addHeader)
49import Servant.API.Internal.Test.ComprehensiveAPI
49import Servant.API.Internal.Test.ComprehensiveAPI
50−import Servant.Server (Server, Handler, err401, err403,
50+import Servant.Server (Server, Handler, Tagged (..), err401, err403,
51 err404, serve, serveWithContext,
51 err404, serve, serveWithContext,
52 Context((:.), EmptyContext))
52 Context((:.), EmptyContext))
53import Test.Hspec (Spec, context, describe, it,
53import Test.Hspec (Spec, context, describe, it,
@@ -210,7 +210,7 @@ captureSpec = do
211 with (return (serve
211 with (return (serve
212 (Proxy :: Proxy (Capture "captured" String :> Raw))
212 (Proxy :: Proxy (Capture "captured" String :> Raw))
213− (\ "captured" request_ respond ->
213+ (\ "captured" -> Tagged $ \request_ respond ->
214 respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
214 respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
215 it "strips the captured path snippet from pathInfo" $ do
215 it "strips the captured path snippet from pathInfo" $ do
216 get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
216 get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
@@ -262,7 +262,7 @@ captureAllSpec = do
263 with (return (serve
263 with (return (serve
264 (Proxy :: Proxy (CaptureAll "segments" String :> Raw))
264 (Proxy :: Proxy (CaptureAll "segments" String :> Raw))
265− (\ _captured request_ respond ->
265+ (\ _captured -> Tagged $ \request_ respond ->
266 respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
266 respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
267 it "consumes everything from pathInfo" $ do
267 it "consumes everything from pathInfo" $ do
268 get "/captured/foo/bar/baz" `shouldRespondWith` (fromString (show ([] :: [Int])))
268 get "/captured/foo/bar/baz" `shouldRespondWith` (fromString (show ([] :: [Int])))
@@ -494,9 +494,10 @@ type RawApi = "foo" :> Raw
494rawApi :: Proxy RawApi
494rawApi :: Proxy RawApi
495rawApi = Proxy
495rawApi = Proxy
497−rawApplication :: Show a => (Request -> a) -> Application
497+rawApplication :: Show a => (Request -> a) -> Tagged m Application
498+rawApplication f = Tagged $ \request_ respond ->
498−rawApplication f request_ respond = respond $ responseLBS ok200 []
499+ respond $ responseLBS ok200 []
499− (cs $ show $ f request_)
500+ (cs $ show $ f request_)
501rawSpec :: Spec
502rawSpec :: Spec
502rawSpec = do
503rawSpec = do
@@ -651,7 +652,7 @@ basicAuthApi = Proxy
651basicAuthServer :: Server BasicAuthAPI
652basicAuthServer :: Server BasicAuthAPI
652basicAuthServer =
653basicAuthServer =
653 const (return jerry) :<|>
654 const (return jerry) :<|>
654− (\ _ respond -> respond $ responseLBS imATeaPot418 [] "")
655+ (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "")
656basicAuthContext :: Context '[ BasicAuthCheck () ]
657basicAuthContext :: Context '[ BasicAuthCheck () ]
657basicAuthContext =
658basicAuthContext =
@@ -696,7 +697,7 @@ genAuthApi = Proxy
697genAuthServer :: Server GenAuthAPI
698genAuthServer :: Server GenAuthAPI
698genAuthServer = const (return tweety)
699genAuthServer = const (return tweety)
699− :<|> (\ _ respond -> respond $ responseLBS imATeaPot418 [] "")
700+ :<|> (Tagged $ \ _ respond -> respond $ responseLBS imATeaPot418 [] "")
701type instance AuthServerData (AuthProtect "auth") = ()
702type instance AuthServerData (AuthProtect "auth") = ()