replace serve with serveWithConfig
This commit is contained in:
parent
60a536382f
commit
1e703be15f
4 changed files with 7 additions and 7 deletions
|
@ -170,7 +170,7 @@ serverConfig :: Config '[ BasicAuthCheck () ]
|
||||||
serverConfig = basicAuthHandler :. EmptyConfig
|
serverConfig = basicAuthHandler :. EmptyConfig
|
||||||
|
|
||||||
basicAuthServer :: Application
|
basicAuthServer :: Application
|
||||||
basicAuthServer = serve basicAuthAPI serverConfig (const (return alice))
|
basicAuthServer = serveWithConfig basicAuthAPI serverConfig (const (return alice))
|
||||||
|
|
||||||
{-# NOINLINE manager #-}
|
{-# NOINLINE manager #-}
|
||||||
manager :: C.Manager
|
manager :: C.Manager
|
||||||
|
|
|
@ -19,7 +19,7 @@ import Servant.Server (BasicAuthCheck (BasicAuthCheck),
|
||||||
, Unauthorized
|
, Unauthorized
|
||||||
),
|
),
|
||||||
Config ((:.), EmptyConfig), Server,
|
Config ((:.), EmptyConfig), Server,
|
||||||
serve)
|
serveWithConfig)
|
||||||
|
|
||||||
-- | let's define some types that our API returns.
|
-- | let's define some types that our API returns.
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ server =
|
||||||
|
|
||||||
-- | hello, server!
|
-- | hello, server!
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = run 8080 (serve api serverConfig server)
|
main = run 8080 (serveWithConfig api serverConfig server)
|
||||||
|
|
||||||
{- Sample session
|
{- Sample session
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ errorOrderServer = \_ _ _ -> throwE err402
|
||||||
errorOrderSpec :: Spec
|
errorOrderSpec :: Spec
|
||||||
errorOrderSpec =
|
errorOrderSpec =
|
||||||
describe "HTTP error order" $
|
describe "HTTP error order" $
|
||||||
with (return $ serve errorOrderApi
|
with (return $ serveWithConfig errorOrderApi
|
||||||
(errorOrderAuthCheck :. EmptyConfig)
|
(errorOrderAuthCheck :. EmptyConfig)
|
||||||
errorOrderServer
|
errorOrderServer
|
||||||
) $ do
|
) $ do
|
||||||
|
@ -183,7 +183,7 @@ errorRetryServer
|
||||||
errorRetrySpec :: Spec
|
errorRetrySpec :: Spec
|
||||||
errorRetrySpec =
|
errorRetrySpec =
|
||||||
describe "Handler search" $
|
describe "Handler search" $
|
||||||
with (return $ serve errorRetryApi
|
with (return $ serveWithConfig errorRetryApi
|
||||||
(errorOrderAuthCheck :. EmptyConfig)
|
(errorOrderAuthCheck :. EmptyConfig)
|
||||||
errorRetryServer
|
errorRetryServer
|
||||||
) $ do
|
) $ do
|
||||||
|
|
|
@ -347,13 +347,13 @@ headerSpec = describe "Servant.API.Header" $ do
|
||||||
expectsString Nothing = error "Expected a string"
|
expectsString Nothing = error "Expected a string"
|
||||||
|
|
||||||
with (return (serve headerApi expectsInt)) $ do
|
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)" $
|
it "passes the header to the handler (Int)" $
|
||||||
delete' "/" "" `shouldRespondWith` 200
|
delete' "/" "" `shouldRespondWith` 200
|
||||||
|
|
||||||
with (return (serve headerApi expectsString)) $ do
|
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)" $
|
it "passes the header to the handler (String)" $
|
||||||
delete' "/" "" `shouldRespondWith` 200
|
delete' "/" "" `shouldRespondWith` 200
|
||||||
|
|
Loading…
Reference in a new issue