@@ -49,7 +49,7 @@ import Servant.API ((:<|>) (..), (:>), Capture, Delete,
4949 StdMethod (..), Verb, addHeader)
5050import Servant.API.Internal.Test.ComprehensiveAPI
5151import Servant.Server (ServantErr (..), Server, err404,
52− serve, Config(EmptyConfig))
52+ serve, serveWithConfig, Config(EmptyConfig))
5353import Test.Hspec (Spec, context, describe, it,
5454 shouldBe, shouldContain)
5555import Test.Hspec.Wai (get, liftIO, matchHeaders,
@@ -67,7 +67,7 @@ import Servant.Server.Internal.Config
6767-- * comprehensive api test
6868
6969-- This declaration simply checks that all instances are in place.
70−_ = serve comprehensiveAPI comprehensiveApiConfig
70+_ = serveWithConfig comprehensiveAPI comprehensiveApiConfig
7171
7272comprehensiveApiConfig :: Config '[NamedConfig "foo" '[]]
7373comprehensiveApiConfig = NamedConfig EmptyConfig :. EmptyConfig
@@ -112,7 +112,7 @@ verbSpec = describe "Servant.API.Verb" $ do
112112 wrongMethod m = if m == methodPatch then methodPost else methodPatch
113113 test desc api method (status :: Int) = context desc $
114114
115− with (return $ serve api EmptyConfig server) $ do
115+ with (return $ serve api server) $ do
116116
117117 -- HEAD and 214/215 need not return bodies
118118 unless (status `elem` [214, 215] || method == methodHead) $
@@ -187,7 +187,7 @@ captureServer legs = case legs of
187187captureSpec :: Spec
188188captureSpec = do
189189 describe "Servant.API.Capture" $ do
190− with (return (serve captureApi EmptyConfig captureServer)) $ do
190+ with (return (serve captureApi captureServer)) $ do
191191
192192 it "can capture parts of the 'pathInfo'" $ do
193193 response <- get "/2"
@@ -198,7 +198,6 @@ captureSpec = do
198198
199199 with (return (serve
200200 (Proxy :: Proxy (Capture "captured" String :> Raw))
201− EmptyConfig
202201 (\ "captured" request_ respond ->
203202 respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
204203 it "strips the captured path snippet from pathInfo" $ do
@@ -232,7 +231,7 @@ queryParamSpec :: Spec
232231queryParamSpec = do
233232 describe "Servant.API.QueryParam" $ do
234233 it "allows retrieving simple GET parameters" $
235− (flip runSession) (serve queryParamApi EmptyConfig qpServer) $ do
234+ (flip runSession) (serve queryParamApi qpServer) $ do
236235 let params1 = "?name=bob"
237236 response1 <- Network.Wai.Test.request defaultRequest{
238237 rawQueryString = params1,
@@ -244,7 +243,7 @@ queryParamSpec = do
244243 }
245244
246245 it "allows retrieving lists in GET parameters" $
247− (flip runSession) (serve queryParamApi EmptyConfig qpServer) $ do
246+ (flip runSession) (serve queryParamApi qpServer) $ do
248247 let params2 = "?names[]=bob&names[]=john"
249248 response2 <- Network.Wai.Test.request defaultRequest{
250249 rawQueryString = params2,
@@ -258,7 +257,7 @@ queryParamSpec = do
258257
259258
260259 it "allows retrieving value-less GET parameters" $
261− (flip runSession) (serve queryParamApi EmptyConfig qpServer) $ do
260+ (flip runSession) (serve queryParamApi qpServer) $ do
262261 let params3 = "?capitalize"
263262 response3 <- Network.Wai.Test.request defaultRequest{
264263 rawQueryString = params3,
@@ -310,7 +309,7 @@ reqBodySpec = describe "Servant.API.ReqBody" $ do
310309 mkReq method x = Test.Hspec.Wai.request method x
311310 [(hContentType, "application/json;charset=utf-8")]
312311
313− with (return $ serve reqBodyApi EmptyConfig server) $ do
312+ with (return $ serve reqBodyApi server) $ do
314313
315314 it "passes the argument to the handler" $ do
316315 response <- mkReq methodPost "" (encode alice)
@@ -343,13 +342,13 @@ headerSpec = describe "Servant.API.Header" $ do
343342 expectsString (Just x) = when (x /= "more from you") $ error "Expected more from you"
344343 expectsString Nothing = error "Expected a string"
345344
346− with (return (serve headerApi EmptyConfig expectsInt)) $ do
345+ with (return (serve headerApi expectsInt)) $ do
347346 let delete' x = Test.Hspec.Wai.request methodDelete x [("MyHeader", "5")]
348347
349348 it "passes the header to the handler (Int)" $
350349 delete' "/" "" `shouldRespondWith` 200
351350
352− with (return (serve headerApi EmptyConfig expectsString)) $ do
351+ with (return (serve headerApi expectsString)) $ do
353352 let delete' x = Test.Hspec.Wai.request methodDelete x [("MyHeader", "more from you")]
354353
355354 it "passes the header to the handler (String)" $
@@ -373,7 +372,7 @@ rawSpec :: Spec
373372rawSpec = do
374373 describe "Servant.API.Raw" $ do
375374 it "runs applications" $ do
376− (flip runSession) (serve rawApi EmptyConfig (rawApplication (const (42 :: Integer)))) $ do
375+ (flip runSession) (serve rawApi (rawApplication (const (42 :: Integer)))) $ do
377376 response <- Network.Wai.Test.request defaultRequest{
378377 pathInfo = ["foo"]
379378 }
@@ -381,7 +380,7 @@ rawSpec = do
381380 simpleBody response `shouldBe` "42"
382381
383382 it "gets the pathInfo modified" $ do
384− (flip runSession) (serve rawApi EmptyConfig (rawApplication pathInfo)) $ do
383+ (flip runSession) (serve rawApi (rawApplication pathInfo)) $ do
385384 response <- Network.Wai.Test.request defaultRequest{
386385 pathInfo = ["foo", "bar"]
387386 }
@@ -415,7 +414,7 @@ alternativeServer =
415414alternativeSpec :: Spec
416415alternativeSpec = do
417416 describe "Servant.API.Alternative" $ do
418− with (return $ serve alternativeApi EmptyConfig alternativeServer) $ do
417+ with (return $ serve alternativeApi alternativeServer) $ do
419418
420419 it "unions endpoints" $ do
421420 response <- get "/foo"
@@ -450,7 +449,7 @@ responseHeadersServer = let h = return $ addHeader 5 $ addHeader "kilroy" "hi"
450449
451450responseHeadersSpec :: Spec
452451responseHeadersSpec = describe "ResponseHeaders" $ do
453− with (return $ serve (Proxy :: Proxy ResponseHeadersApi) EmptyConfig responseHeadersServer) $ do
452+ with (return $ serve (Proxy :: Proxy ResponseHeadersApi) responseHeadersServer) $ do
454453
455454 let methods = [methodGet, methodPost, methodPut, methodPatch]
456455
@@ -516,7 +515,7 @@ miscServ = versionHandler
516515 hostHandler = return . show
517516
518517miscCombinatorSpec :: Spec
519−miscCombinatorSpec = with (return $ serve miscApi EmptyConfig miscServ) $
518+miscCombinatorSpec = with (return $ serve miscApi miscServ) $
520519 describe "Misc. combinators for request inspection" $ do
521520 it "Successfully gets the HTTP version specified in the request" $
522521 go "/version" "\"HTTP/1.0\""