git.iko.soy/typeable/servant
on master help sign in
Replace all occurances of () with NoContent

We use NoContent to signify an empty response nowadays. This commit replaces all occurences of () with NoContent so that all packages use the new semantics.

commit05379ed7e39f06e148f4a6f5d9a88433a706f312 authorArian van Putten <aeroboy94@gmail.com> dateFri 8 Jul 2016, 09:11 (10 years ago) parentd45c7c5
18 files changed+81−70
servant-docs/example/greet.hs+2−2 servant-docs/src/Servant/Docs/Internal.hs+1−1 servant-foreign/src/Servant/Foreign/Internal.hs+6−6 servant-foreign/test/Servant/ForeignSpec.hs+4−4 servant-js/servant-js.cabal+1 servant-js/src/Servant/JS.hs+6−5 servant-js/src/Servant/JS/Internal.hs+2−2 servant-js/test/Servant/JSSpec.hs+3−2 servant-js/test/Servant/JSSpec/CustomHeaders.hs+13−12 servant-mock/src/Servant/Mock.hs+3 servant-server/example/greet.hs+2−2 servant-server/src/Servant/Server.hs+1−1 servant-server/test/Servant/Server/RouterSpec.hs+1−1 servant-server/test/Servant/ServerSpec.hs+11−7 servant/src/Servant/API/ContentTypes.hs+1−1 servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+3−3 servant/src/Servant/Utils/Links.hs+4−4 servant/test/Servant/Utils/LinksSpec.hs+17−17
servant-docs/example/greet.hs+2−2
@@ -81,7 +81,7 @@ type TestApi =
8181 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] (Headers '[Header "X-Example" Int] Greet)
8282
8383 -- DELETE /greet/:greetid
84− :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
84+ :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
8585
8686testApi :: Proxy TestApi
8787testApi = Proxy
@@ -91,7 +91,7 @@ testApi = Proxy
9191-- notes.
9292extra :: ExtraInfo TestApi
9393extra =
94− extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] ())) $
94+ extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent)) $
9595 defAction & headers <>~ ["unicorns"]
9696 & notes <>~ [ DocNote "Title" ["This is some text"]
9797 , DocNote "Second secton" ["And some more"]
servant-docs/src/Servant/Docs/Internal.hs+1−1
@@ -833,7 +833,7 @@ instance (ToAuthInfo (BasicAuth realm usr), HasDocs api) => HasDocs (BasicAuth r
833833 action' = over authInfo (|> toAuthInfo authProxy) action
834834
835835-- ToSample instances for simple types
836−instance ToSample ()
836+instance ToSample NoContent
837837instance ToSample Bool
838838instance ToSample Ordering
839839
servant-foreign/src/Servant/Foreign/Internal.hs+6−6
@@ -169,11 +169,11 @@ type family Elem (a :: *) (ls::[*]) :: Constraint where
169169-- > getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
170170--
171171-- > -- If language __X__ is dynamically typed then you can use
172−-- > -- a predefined NoTypes parameter with the () output type:
172+-- > -- a predefined NoTypes parameter with the NoContent output type:
173173--
174−-- > getEndpoints :: (HasForeign NoTypes () api, GenerateList Text (Foreign () api))
175−-- > => Proxy api -> [Req ()]
176−-- > getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) api
174+-- > getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
175+-- > => Proxy api -> [Req NoContent]
176+-- > getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
177177-- >
178178--
179179class HasForeignType lang ftype a where
@@ -181,8 +181,8 @@ class HasForeignType lang ftype a where
181181
182182data NoTypes
183183
184−instance HasForeignType NoTypes () ftype where
185− typeFor _ _ _ = ()
184+instance HasForeignType NoTypes NoContent ftype where
185+ typeFor _ _ _ = NoContent
186186
187187class HasForeign lang ftype (api :: *) where
188188 type Foreign ftype api :: *
servant-foreign/test/Servant/ForeignSpec.hs+4−4
@@ -26,7 +26,7 @@ camelCaseSpec = describe "camelCase" $ do
2626
2727data LangX
2828
29−instance HasForeignType LangX String () where
29+instance HasForeignType LangX String NoContent where
3030 typeFor _ _ _ = "voidX"
3131
3232instance HasForeignType LangX String Int where
@@ -43,9 +43,9 @@ instance OVERLAPPABLE_ HasForeignType LangX String a => HasForeignType LangX Str
4343
4444type TestApi
4545 = "test" :> Header "header" [String] :> QueryFlag "flag" :> Get '[JSON] Int
46− :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] ()
47− :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] ()
48− :<|> "test" :> Capture "id" Int :> Delete '[JSON] ()
46+ :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] NoContent
47+ :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent
48+ :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent
4949
5050testApi :: [Req String]
5151testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi)
servant-js/servant-js.cabal+1
@@ -46,6 +46,7 @@ library
4646 , charset >= 0.3
4747 , lens >= 4
4848 , servant-foreign == 0.7.*
49+ , servant == 0.7.*
4950 , text >= 1.2 && < 1.3
5051
5152 hs-source-dirs: src
servant-js/src/Servant/JS.hs+6−5
@@ -118,6 +118,7 @@ import Prelude hiding (writeFile)
118118import Data.Proxy
119119import Data.Text
120120import Data.Text.IO (writeFile)
121+import Servant.API.ContentTypes
121122import Servant.JS.Angular
122123import Servant.JS.Axios
123124import Servant.JS.Internal
@@ -128,22 +129,22 @@ import Servant.Foreign (listFromAPI)
128129-- | Generate the data necessary to generate javascript code
129130-- for all the endpoints of an API, as ':<|>'-separated values
130131-- of type 'AjaxReq'.
131−javascript :: HasForeign NoTypes () api => Proxy api -> Foreign () api
132−javascript p = foreignFor (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) p defReq
132+javascript :: HasForeign NoTypes NoContent api => Proxy api -> Foreign NoContent api
133+javascript p = foreignFor (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) p defReq
133134
134135-- | Directly generate all the javascript functions for your API
135136-- from a 'Proxy' for your API type. You can then write it to
136137-- a file or integrate it in a page, for example.
137−jsForAPI :: (HasForeign NoTypes () api, GenerateList () (Foreign () api))
138+jsForAPI :: (HasForeign NoTypes NoContent api, GenerateList NoContent (Foreign NoContent api))
138139 => Proxy api -- ^ proxy for your API type
139140 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
140141 -> Text -- ^ a text that you can embed in your pages or write to a file
141−jsForAPI p gen = gen (listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) p)
142+jsForAPI p gen = gen (listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) p)
142143
143144-- | Directly generate all the javascript functions for your API
144145-- from a 'Proxy' for your API type using the given generator
145146-- and write the resulting code to a file at the given path.
146−writeJSForAPI :: (HasForeign NoTypes () api, GenerateList () (Foreign () api))
147+writeJSForAPI :: (HasForeign NoTypes NoContent api, GenerateList NoContent (Foreign NoContent api))
147148 => Proxy api -- ^ proxy for your API type
148149 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
149150 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
servant-js/src/Servant/JS/Internal.hs+2−2
@@ -54,12 +54,12 @@ import qualified Data.Text as T
5454import Data.Text (Text)
5555import Servant.Foreign
5656
57−type AjaxReq = Req ()
57+type AjaxReq = Req NoContent
5858
5959-- A 'JavascriptGenerator' just takes the data found in the API type
6060-- for each endpoint and generates Javascript code in a Text. Several
6161-- generators are available in this package.
62−type JavaScriptGenerator = [Req ()] -> Text
62+type JavaScriptGenerator = [Req NoContent] -> Text
6363
6464-- | This structure is used by specific implementations to let you
6565-- customize the output
servant-js/test/Servant/JSSpec.hs+3−2
@@ -21,6 +21,7 @@ import Prelude.Compat
2121import Test.Hspec hiding (shouldContain, shouldNotContain)
2222
2323import Servant.API.Internal.Test.ComprehensiveAPI
24+import Servant.API.ContentTypes
2425import Servant.JS
2526import Servant.JS.Internal
2627import qualified Servant.JS.Angular as NG
@@ -105,7 +106,7 @@ a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
105106
106107axiosSpec :: Spec
107108axiosSpec = describe specLabel $ do
108− let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) (Proxy :: Proxy TestAPI)
109+ let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) (Proxy :: Proxy TestAPI)
109110 it "should add withCredentials when needed" $ do
110111 let jsText = genJS withCredOpts $ reqList
111112 output jsText
@@ -129,7 +130,7 @@ axiosSpec = describe specLabel $ do
129130
130131angularSpec :: TestNames -> Spec
131132angularSpec test = describe specLabel $ do
132− let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) (Proxy :: Proxy TestAPI)
133+ let reqList = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) (Proxy :: Proxy TestAPI)
133134 it "should implement a service globally" $ do
134135 let jsText = genJS reqList
135136 output jsText
servant-js/test/Servant/JSSpec/CustomHeaders.hs+13−12
@@ -16,6 +16,7 @@ import Data.Monoid
1616import Data.Proxy
1717import Data.Text (pack)
1818import GHC.TypeLits
19+import Servant.API.ContentTypes
1920import Servant.JS.Internal
2021
2122-- | This is a hypothetical combinator that fetches an Authorization header.
@@ -23,13 +24,13 @@ import Servant.JS.Internal
2324-- using -- Basic, Digest, whatever.
2425data Authorization (sym :: Symbol) a
2526
26−instance (KnownSymbol sym, HasForeign lang () api)
27− => HasForeign lang () (Authorization sym a :> api) where
28− type Foreign () (Authorization sym a :> api) = Foreign () api
27+instance (KnownSymbol sym, HasForeign lang NoContent api)
28+ => HasForeign lang NoContent (Authorization sym a :> api) where
29+ type Foreign NoContent (Authorization sym a :> api) = Foreign NoContent api
2930
3031 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
3132 req & reqHeaders <>~
32− [ ReplaceHeaderArg (Arg "Authorization" ())
33+ [ ReplaceHeaderArg (Arg "Authorization" NoContent)
3334 $ tokenType (pack . symbolVal $ (Proxy :: Proxy sym)) ]
3435 where
3536 tokenType t = t <> " {Authorization}"
@@ -37,23 +38,23 @@ instance (KnownSymbol sym, HasForeign lang () api)
3738-- | This is a combinator that fetches an X-MyLovelyHorse header.
3839data MyLovelyHorse a
3940
40−instance (HasForeign lang () api)
41− => HasForeign lang () (MyLovelyHorse a :> api) where
42− type Foreign () (MyLovelyHorse a :> api) = Foreign () api
41+instance (HasForeign lang NoContent api)
42+ => HasForeign lang NoContent (MyLovelyHorse a :> api) where
43+ type Foreign NoContent (MyLovelyHorse a :> api) = Foreign NoContent api
4344
4445 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
45− req & reqHeaders <>~ [ ReplaceHeaderArg (Arg "X-MyLovelyHorse" ()) tpl ]
46+ req & reqHeaders <>~ [ ReplaceHeaderArg (Arg "X-MyLovelyHorse" NoContent) tpl ]
4647 where
4748 tpl = "I am good friends with {X-MyLovelyHorse}"
4849
4950-- | This is a combinator that fetches an X-WhatsForDinner header.
5051data WhatsForDinner a
5152
52−instance (HasForeign lang () api)
53− => HasForeign lang () (WhatsForDinner a :> api) where
54− type Foreign () (WhatsForDinner a :> api) = Foreign () api
53+instance (HasForeign lang NoContent api)
54+ => HasForeign lang NoContent (WhatsForDinner a :> api) where
55+ type Foreign NoContent (WhatsForDinner a :> api) = Foreign NoContent api
5556
5657 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
57− req & reqHeaders <>~ [ ReplaceHeaderArg (Arg "X-WhatsForDinner" ()) tpl ]
58+ req & reqHeaders <>~ [ ReplaceHeaderArg (Arg "X-WhatsForDinner" NoContent) tpl ]
5859 where
5960 tpl = "I would like {X-WhatsForDinner} with a cherry on top."
servant-mock/src/Servant/Mock.hs+3
@@ -180,3 +180,6 @@ instance Arbitrary (HList '[]) where
180180instance (Arbitrary a, Arbitrary (HList hs))
181181 => Arbitrary (HList (Header h a ': hs)) where
182182 arbitrary = HCons <$> fmap Header arbitrary <*> arbitrary
183+
184+instance Arbitrary NoContent where
185+ arbitrary = pure NoContent
servant-server/example/greet.hs+2−2
@@ -34,7 +34,7 @@ type TestApi =
3434 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
3535
3636 -- DELETE /greet/:greetid
37− :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
37+ :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
3838
3939testApi :: Proxy TestApi
4040testApi = Proxy
@@ -54,7 +54,7 @@ server = helloH :<|> postGreetH :<|> deleteGreetH
5454
5555 postGreetH greet = return greet
5656
57− deleteGreetH _ = return ()
57+ deleteGreetH _ = return NoContent
5858
5959-- Turn the server into a WAI app. 'serve' is provided by servant,
6060-- more precisely by the Servant.Server module.
servant-server/src/Servant/Server.hs+1−1
@@ -147,7 +147,7 @@ serveWithContext p context server =
147147-- For the following API
148148--
149149-- > type API =
150−-- > "a" :> "d" :> Get '[JSON] ()
150+-- > "a" :> "d" :> Get '[JSON] NoContent
151151-- > :<|> "b" :> Capture "x" Int :> Get '[JSON] Bool
152152-- > :<|> "c" :> Put '[JSON] Bool
153153-- > :<|> "a" :> "e" :> Get '[JSON] Int
servant-server/test/Servant/Server/RouterSpec.hs+1−1
@@ -74,7 +74,7 @@ makeTrivialRouter :: (HasServer layout '[]) => Proxy layout -> Router ()
7474makeTrivialRouter p =
7575 route p EmptyContext (emptyDelayed (FailFatal err501))
7676
77−type End = Get '[JSON] ()
77+type End = Get '[JSON] NoContent
7878
7979-- The latter version looks more efficient,
8080-- but the former should be compiled to the
servant-server/test/Servant/ServerSpec.hs+11−7
@@ -340,19 +340,23 @@ reqBodySpec = describe "Servant.API.ReqBody" $ do
340340-- * headerSpec {{{
341341------------------------------------------------------------------------------
342342
343−type HeaderApi a = Header "MyHeader" a :> Delete '[JSON] ()
343+type HeaderApi a = Header "MyHeader" a :> Delete '[JSON] NoContent
344344headerApi :: Proxy (HeaderApi a)
345345headerApi = Proxy
346346
347347headerSpec :: Spec
348348headerSpec = describe "Servant.API.Header" $ do
349349
350− let expectsInt :: Maybe Int -> Handler ()
351− expectsInt (Just x) = when (x /= 5) $ error "Expected 5"
350+ let expectsInt :: Maybe Int -> Handler NoContent
351+ expectsInt (Just x) = do
352+ when (x /= 5) $ error "Expected 5"
353+ return NoContent
352354 expectsInt Nothing = error "Expected an int"
353355
354− let expectsString :: Maybe String -> Handler ()
355− expectsString (Just x) = when (x /= "more from you") $ error "Expected more from you"
356+ let expectsString :: Maybe String -> Handler NoContent
357+ expectsString (Just x) = do
358+ when (x /= "more from you") $ error "Expected more from you"
359+ return NoContent
356360 expectsString Nothing = error "Expected a string"
357361
358362 with (return (serve headerApi expectsInt)) $ do
@@ -410,7 +414,7 @@ type AlternativeApi =
410414 :<|> "foo" :> Get '[PlainText] T.Text
411415 :<|> "bar" :> Post '[JSON] Animal
412416 :<|> "bar" :> Put '[JSON] Animal
413− :<|> "bar" :> Delete '[JSON] ()
417+ :<|> "bar" :> Delete '[JSON] NoContent
414418
415419alternativeApi :: Proxy AlternativeApi
416420alternativeApi = Proxy
@@ -422,7 +426,7 @@ alternativeServer =
422426 :<|> return "a string"
423427 :<|> return jerry
424428 :<|> return jerry
425− :<|> return ()
429+ :<|> return NoContent
426430
427431alternativeSpec :: Spec
428432alternativeSpec = do
servant/src/Servant/API/ContentTypes.hs+1−1
@@ -319,7 +319,7 @@ instance MimeRender OctetStream BS.ByteString where
319319
320320-- | A type for responses without content-body.
321321data NoContent = NoContent
322− deriving (Show, Eq, Read)
322+ deriving (Show, Eq, Read, Generic)
323323
324324
325325--------------------------------------------------------------------------
servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+3−3
@@ -10,7 +10,7 @@ import Data.Proxy
1010
1111import Servant.API
1212
13−type GET = Get '[JSON] ()
13+type GET = Get '[JSON] NoContent
1414
1515type ComprehensiveAPI =
1616 GET :<|>
@@ -25,10 +25,10 @@ type ComprehensiveAPI =
2525-- Raw :<|>
2626 RemoteHost :> GET :<|>
2727 ReqBody '[JSON] Int :> GET :<|>
28− Get '[JSON] (Headers '[Header "foo" Int] ()) :<|>
28+ Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|>
2929 "foo" :> GET :<|>
3030 Vault :> GET :<|>
31− Verb 'POST 204 '[JSON] () :<|>
31+ Verb 'POST 204 '[JSON] NoContent :<|>
3232 Verb 'POST 204 '[JSON] Int :<|>
3333 WithNamedContext "foo" '[] GET
3434
servant/src/Servant/Utils/Links.hs+4−4
@@ -21,7 +21,7 @@
2121-- >>>
2222-- >>>
2323-- >>> type Hello = "hello" :> Get '[JSON] Int
24−-- >>> type Bye = "bye" :> QueryParam "name" String :> Delete '[JSON] ()
24+-- >>> type Bye = "bye" :> QueryParam "name" String :> Delete '[JSON] NoContent
2525-- >>> type API = Hello :<|> Bye
2626-- >>> let api = Proxy :: Proxy API
2727--
@@ -47,11 +47,11 @@
4747-- If the API has an endpoint with parameters then we can generate links with
4848-- or without those:
4949--
50−-- >>> let with = Proxy :: Proxy ("bye" :> QueryParam "name" String :> Delete '[JSON] ())
50+-- >>> let with = Proxy :: Proxy ("bye" :> QueryParam "name" String :> Delete '[JSON] NoContent)
5151-- >>> print $ safeLink api with (Just "Hubert")
5252-- bye?name=Hubert
5353--
54−-- >>> let without = Proxy :: Proxy ("bye" :> Delete '[JSON] ())
54+-- >>> let without = Proxy :: Proxy ("bye" :> Delete '[JSON] NoContent)
5555-- >>> print $ safeLink api without
5656-- bye
5757--
@@ -69,7 +69,7 @@
6969-- Attempting to construct a link to an endpoint that does not exist in api
7070-- will result in a type error like this:
7171--
72−-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] ())
72+-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
7373-- >>> safeLink api bad_link
7474-- ...
7575-- ...Could not deduce...
servant/test/Servant/Utils/LinksSpec.hs+17−17
@@ -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