@@ -45,6 +45,7 @@ alice = Person "Alice" 42
4545
4646type Api =
4747 "get" :> Get Person
48+ :<|> "delete" :> Delete
4849 :<|> "capture" :> Capture "name" String :> Get Person
4950 :<|> "body" :> ReqBody Person :> Post Person
5051 :<|> "param" :> QueryParam "name" String :> Get Person
@@ -67,6 +68,7 @@ api = Proxy
6768server :: Application
6869server = serve api (
6970 return alice
71+ :<|> return ()
7072 :<|> (\ name -> return $ Person name 0)
7173 :<|> return
7274 :<|> (\ name -> case name of
@@ -90,6 +92,7 @@ withServer :: (BaseUrl -> IO a) -> IO a
9092withServer action = withWaiDaemon (return server) action
9193
9294getGet :: BaseUrl -> EitherT String IO Person
95+getDelete :: BaseUrl -> EitherT String IO ()
9396getCapture :: String -> BaseUrl -> EitherT String IO Person
9497getBody :: Person -> BaseUrl -> EitherT String IO Person
9598getQueryParam :: Maybe String -> BaseUrl -> EitherT String IO Person
@@ -104,6 +107,7 @@ getMultiple :: String -> Maybe Int -> Bool -> [(String, [Rational])]
104107 -> BaseUrl
105108 -> EitherT String IO (String, Maybe Int, Bool, [(String, [Rational])])
106109( getGet
110+ :<|> getDelete
107111 :<|> getCapture
108112 :<|> getBody
109113 :<|> getQueryParam
@@ -122,6 +126,9 @@ spec = do
122126 it "Servant.API.Get" $ withServer $ \ host -> do
123127 runEitherT (getGet host) `shouldReturn` Right alice
124128
129+ it "Servant.API.Delete" $ withServer $ \ host -> do
130+ runEitherT (getDelete host) `shouldReturn` Right ()
131+
125132 it "Servant.API.Capture" $ withServer $ \ host -> do
126133 runEitherT (getCapture "Paula" host) `shouldReturn` Right (Person "Paula" 0)
127134