@@ -12,16 +12,16 @@ import Servant.API
1212
1313type TestApi =
1414 -- Capture and query params
15− "hello" :> Capture "name" String :> QueryParam "capital" Bool :> Delete '[JSON] ()
15+ "hello" :> Capture "name" String :> QueryParam "capital" Bool :> Delete '[JSON] NoContent
1616
1717 -- Flags
18− :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] ()
18+ :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] NoContent
1919
2020 -- All of the verbs
21− :<|> "get" :> Get '[JSON] ()
22− :<|> "put" :> Put '[JSON] ()
23− :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] ()
24− :<|> "delete" :> Header "ponies" String :> Delete '[JSON] ()
21+ :<|> "get" :> Get '[JSON] NoContent
22+ :<|> "put" :> Put '[JSON] NoContent
23+ :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
24+ :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
2525 :<|> "raw" :> Raw
2626
2727
@@ -38,26 +38,26 @@ shouldBeURI link expected =
3838spec :: Spec
3939spec = describe "Servant.Utils.Links" $ do
4040 it "generates correct links for capture query params" $ do
41− let l1 = Proxy :: Proxy ("hello" :> Capture "name" String :> Delete '[JSON] ())
41+ let l1 = Proxy :: Proxy ("hello" :> Capture "name" String :> Delete '[JSON] NoContent)
4242 apiLink l1 "hi" `shouldBeURI` "hello/hi"
4343
4444 let l2 = Proxy :: Proxy ("hello" :> Capture "name" String
4545 :> QueryParam "capital" Bool
46− :> Delete '[JSON] ())
46+ :> Delete '[JSON] NoContent)
4747 apiLink l2 "bye" (Just True) `shouldBeURI` "hello/bye?capital=true"
4848
4949
5050 it "generates correct links for query flags" $ do
5151 let l1 = Proxy :: Proxy ("balls" :> QueryFlag "bouncy"
52− :> QueryFlag "fast" :> Delete '[JSON] ())
52+ :> QueryFlag "fast" :> Delete '[JSON] NoContent)
5353 apiLink l1 True True `shouldBeURI` "balls?bouncy&fast"
5454 apiLink l1 False True `shouldBeURI` "balls?fast"
5555
5656 it "generates correct links for all of the verbs" $ do
57− apiLink (Proxy :: Proxy ("get" :> Get '[JSON] ())) `shouldBeURI` "get"
58− apiLink (Proxy :: Proxy ("put" :> Put '[JSON] ())) `shouldBeURI` "put"
59− apiLink (Proxy :: Proxy ("post" :> Post '[JSON] ())) `shouldBeURI` "post"
60− apiLink (Proxy :: Proxy ("delete" :> Delete '[JSON] ())) `shouldBeURI` "delete"
57+ apiLink (Proxy :: Proxy ("get" :> Get '[JSON] NoContent)) `shouldBeURI` "get"
58+ apiLink (Proxy :: Proxy ("put" :> Put '[JSON] NoContent)) `shouldBeURI` "put"
59+ apiLink (Proxy :: Proxy ("post" :> Post '[JSON] NoContent)) `shouldBeURI` "post"
60+ apiLink (Proxy :: Proxy ("delete" :> Delete '[JSON] NoContent)) `shouldBeURI` "delete"
6161 apiLink (Proxy :: Proxy ("raw" :> Raw)) `shouldBeURI` "raw"
6262
6363
@@ -93,9 +93,9 @@ spec = describe "Servant.Utils.Links" $ do
9393-- sanity check
9494-- >>> apiLink (Proxy :: Proxy AllGood)
9595-- get
96−type WrongPath = "getTypo" :> Get '[JSON] ()
96+type WrongPath = "getTypo" :> Get '[JSON] NoContent
9797type WrongReturnType = "get" :> Get '[JSON] Bool
98−type WrongContentType = "get" :> Get '[OctetStream] ()
99−type WrongMethod = "get" :> Post '[JSON] ()
98+type WrongContentType = "get" :> Get '[OctetStream] NoContent
99+type WrongMethod = "get" :> Post '[JSON] NoContent
100100type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
101−type AllGood = "get" :> Get '[JSON] ()
101+type AllGood = "get" :> Get '[JSON] NoContent