@@ -12,16 +12,16 @@ import Servant.API
13type TestApi =
13type TestApi =
14 -- Capture and query params
14 -- 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
18− :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] ()
18+ :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] NoContent
20 -- All of the verbs
20 -- All of the verbs
21− :<|> "get" :> Get '[JSON] ()
21+ :<|> "get" :> Get '[JSON] NoContent
22− :<|> "put" :> Put '[JSON] ()
22+ :<|> "put" :> Put '[JSON] NoContent
23− :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] ()
23+ :<|> "post" :> ReqBody '[JSON] 'True :> Post '[JSON] NoContent
24− :<|> "delete" :> Header "ponies" String :> Delete '[JSON] ()
24+ :<|> "delete" :> Header "ponies" String :> Delete '[JSON] NoContent
25 :<|> "raw" :> Raw
25 :<|> "raw" :> Raw
@@ -38,26 +38,26 @@ shouldBeURI link expected =
38spec :: Spec
38spec :: Spec
39spec = describe "Servant.Utils.Links" $ do
39spec = describe "Servant.Utils.Links" $ do
40 it "generates correct links for capture query params" $ do
40 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)
42 apiLink l1 "hi" `shouldBeURI` "hello/hi"
42 apiLink l1 "hi" `shouldBeURI` "hello/hi"
44 let l2 = Proxy :: Proxy ("hello" :> Capture "name" String
44 let l2 = Proxy :: Proxy ("hello" :> Capture "name" String
45 :> QueryParam "capital" Bool
45 :> QueryParam "capital" Bool
46− :> Delete '[JSON] ())
46+ :> Delete '[JSON] NoContent)
47 apiLink l2 "bye" (Just True) `shouldBeURI` "hello/bye?capital=true"
47 apiLink l2 "bye" (Just True) `shouldBeURI` "hello/bye?capital=true"
50 it "generates correct links for query flags" $ do
50 it "generates correct links for query flags" $ do
51 let l1 = Proxy :: Proxy ("balls" :> QueryFlag "bouncy"
51 let l1 = Proxy :: Proxy ("balls" :> QueryFlag "bouncy"
52− :> QueryFlag "fast" :> Delete '[JSON] ())
52+ :> QueryFlag "fast" :> Delete '[JSON] NoContent)
53 apiLink l1 True True `shouldBeURI` "balls?bouncy&fast"
53 apiLink l1 True True `shouldBeURI` "balls?bouncy&fast"
54 apiLink l1 False True `shouldBeURI` "balls?fast"
54 apiLink l1 False True `shouldBeURI` "balls?fast"
56 it "generates correct links for all of the verbs" $ do
56 it "generates correct links for all of the verbs" $ do
57− apiLink (Proxy :: Proxy ("get" :> Get '[JSON] ())) `shouldBeURI` "get"
57+ apiLink (Proxy :: Proxy ("get" :> Get '[JSON] NoContent)) `shouldBeURI` "get"
58− apiLink (Proxy :: Proxy ("put" :> Put '[JSON] ())) `shouldBeURI` "put"
58+ apiLink (Proxy :: Proxy ("put" :> Put '[JSON] NoContent)) `shouldBeURI` "put"
59− apiLink (Proxy :: Proxy ("post" :> Post '[JSON] ())) `shouldBeURI` "post"
59+ apiLink (Proxy :: Proxy ("post" :> Post '[JSON] NoContent)) `shouldBeURI` "post"
60− apiLink (Proxy :: Proxy ("delete" :> Delete '[JSON] ())) `shouldBeURI` "delete"
60+ apiLink (Proxy :: Proxy ("delete" :> Delete '[JSON] NoContent)) `shouldBeURI` "delete"
61 apiLink (Proxy :: Proxy ("raw" :> Raw)) `shouldBeURI` "raw"
61 apiLink (Proxy :: Proxy ("raw" :> Raw)) `shouldBeURI` "raw"
@@ -93,9 +93,9 @@ spec = describe "Servant.Utils.Links" $ do
93-- sanity check
93-- sanity check
94-- >>> apiLink (Proxy :: Proxy AllGood)
94-- >>> apiLink (Proxy :: Proxy AllGood)
96−type WrongPath = "getTypo" :> Get '[JSON] ()
96+type WrongPath = "getTypo" :> Get '[JSON] NoContent
97type WrongReturnType = "get" :> Get '[JSON] Bool
97type WrongReturnType = "get" :> Get '[JSON] Bool
98−type WrongContentType = "get" :> Get '[OctetStream] ()
98+type WrongContentType = "get" :> Get '[OctetStream] NoContent
99−type WrongMethod = "get" :> Post '[JSON] ()
99+type WrongMethod = "get" :> Post '[JSON] NoContent
100type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
100type NotALink = "hello" :> ReqBody '[JSON] 'True :> Get '[JSON] Bool
101−type AllGood = "get" :> Get '[JSON] ()
101+type AllGood = "get" :> Get '[JSON] NoContent