replace serve with serveWithConfig

This commit is contained in:
aaron levin 2016-03-06 21:16:28 +01:00
parent 60a536382f
commit 1e703be15f
4 changed files with 7 additions and 7 deletions

View file

@ -170,7 +170,7 @@ serverConfig :: Config '[ BasicAuthCheck () ]
serverConfig = basicAuthHandler :. EmptyConfig
basicAuthServer :: Application
basicAuthServer = serve basicAuthAPI serverConfig (const (return alice))
basicAuthServer = serveWithConfig basicAuthAPI serverConfig (const (return alice))
{-# NOINLINE manager #-}
manager :: C.Manager

View file

@ -19,7 +19,7 @@ import Servant.Server (BasicAuthCheck (BasicAuthCheck),
, Unauthorized
),
Config ((:.), EmptyConfig), Server,
serve)
serveWithConfig)
-- | let's define some types that our API returns.
@ -80,7 +80,7 @@ server =
-- | hello, server!
main :: IO ()
main = run 8080 (serve api serverConfig server)
main = run 8080 (serveWithConfig api serverConfig server)
{- Sample session

View file

@ -56,7 +56,7 @@ errorOrderServer = \_ _ _ -> throwE err402
errorOrderSpec :: Spec
errorOrderSpec =
describe "HTTP error order" $
with (return $ serve errorOrderApi
with (return $ serveWithConfig errorOrderApi
(errorOrderAuthCheck :. EmptyConfig)
errorOrderServer
) $ do
@ -183,7 +183,7 @@ errorRetryServer
errorRetrySpec :: Spec
errorRetrySpec =
describe "Handler search" $
with (return $ serve errorRetryApi
with (return $ serveWithConfig errorRetryApi
(errorOrderAuthCheck :. EmptyConfig)
errorRetryServer
) $ do

View file

@ -347,13 +347,13 @@ headerSpec = describe "Servant.API.Header" $ do
expectsString Nothing = error "Expected a string"
with (return (serve headerApi expectsInt)) $ do
let delete' x = Test.Hspec.Wai.request methodDelete x [("MyHeader", "5")]
let delete' x = THW.request methodDelete x [("MyHeader", "5")]
it "passes the header to the handler (Int)" $
delete' "/" "" `shouldRespondWith` 200
with (return (serve headerApi expectsString)) $ do
let delete' x = Test.Hspec.Wai.request methodDelete x [("MyHeader", "more from you")]
let delete' x = THW.request methodDelete x [("MyHeader", "more from you")]
it "passes the header to the handler (String)" $
delete' "/" "" `shouldRespondWith` 200