on master help sign in
Merge tag 'v0.8' into client-ghcjs_7.1
187fe5bSönke Hahn
doc/tutorial/tutorial.cabal+7−6
@@ -1,5 +1,5 @@
1name: tutorial
1name: tutorial
2−version: 0.7.1
2+version: 0.8
3synopsis: The servant tutorial
3synopsis: The servant tutorial
4homepage: http://haskell-servant.readthedocs.org/
4homepage: http://haskell-servant.readthedocs.org/
5license: BSD3
5license: BSD3
@@ -25,11 +25,11 @@ library
25 , directory
25 , directory
26 , blaze-markup
26 , blaze-markup
27 , containers
27 , containers
28− , servant == 0.7.*
28+ , servant == 0.8.*
29− , servant-server == 0.7.*
29+ , servant-server == 0.8.*
30− , servant-client == 0.7.*
30+ , servant-client == 0.8.*
31− , servant-docs == 0.7.*
31+ , servant-docs == 0.8.*
32− , servant-js == 0.7.*
32+ , servant-js == 0.8.*
33 , warp
33 , warp
34 , http-media
34 , http-media
35 , lucid
35 , lucid
@@ -54,6 +54,7 @@ test-suite spec
54 default-language: Haskell2010
54 default-language: Haskell2010
55 hs-source-dirs: test
55 hs-source-dirs: test
56 main-is: Spec.hs
56 main-is: Spec.hs
57+ other-modules: JavascriptSpec
57 build-depends: base == 4.*
58 build-depends: base == 4.*
58 , tutorial
59 , tutorial
59 , hspec
60 , hspec
servant-client/servant-client.cabal+24−22
@@ -1,5 +1,5 @@
1name: servant-client
1name: servant-client
2−version: 0.7.1
2+version: 0.8
3synopsis: automatical derivation of querying functions for servant webservices
3synopsis: automatical derivation of querying functions for servant webservices
4description:
4description:
5 This library lets you derive automatically Haskell functions that
5 This library lets you derive automatically Haskell functions that
@@ -44,29 +44,29 @@ library
44 other-modules:
44 other-modules:
45 Servant.Client.PerformRequest.GHC
45 Servant.Client.PerformRequest.GHC
46 build-depends:
46 build-depends:
47− base >=4.7 && <5
47+ base >= 4.7 && < 4.10
48− , aeson
48+ , aeson >= 0.7 && < 0.12
49− , attoparsec
49+ , attoparsec >= 0.12 && < 0.14
50− , base64-bytestring
50+ , base64-bytestring >= 1.0.0.1 && < 1.1
51− , bytestring
51+ , bytestring >= 0.10 && < 0.11
52− , case-insensitive
53− , exceptions
52+ , exceptions >= 0.8 && < 0.9
54− , http-api-data >= 0.1 && < 0.3
53+ , http-api-data >= 0.1 && < 0.3
55− , http-client <0.5
54+ , http-client >= 0.4.18.1 && < 0.6
56− , http-client-tls
55+ , http-client-tls >= 0.2.2 && < 0.4
57− , http-media
56+ , http-media >= 0.6.2 && < 0.7
58− , http-types
57+ , http-types >= 0.8.6 && < 0.10
59− , network-uri >= 2.6
58+ , network-uri >= 2.6 && < 2.7
60− , safe
59+ , safe >= 0.3.9 && < 0.4
61− , servant == 0.7.*
60+ , servant == 0.8.*
62− , string-conversions
61+ , string-conversions >= 0.3 && < 0.5
63− , text
62+ , text >= 1.2 && < 1.3
64− , transformers
63+ , transformers >= 0.3 && < 0.6
65− , transformers-compat
64+ , transformers-compat >= 0.4 && < 0.6
66 if impl(ghcjs)
65 if impl(ghcjs)
67 build-depends:
66 build-depends:
68 ghcjs-base
67 ghcjs-base
69 , ghcjs-prim
68 , ghcjs-prim
69+ , case-insensitive
70 hs-source-dirs: src
70 hs-source-dirs: src
71 default-language: Haskell2010
71 default-language: Haskell2010
72 ghc-options: -Wall
72 ghc-options: -Wall
@@ -77,6 +77,8 @@ library
77test-suite spec
77test-suite spec
78 type: exitcode-stdio-1.0
78 type: exitcode-stdio-1.0
79 ghc-options: -Wall -fno-warn-name-shadowing
79 ghc-options: -Wall -fno-warn-name-shadowing
80+ if impl(ghc >= 8.0)
81+ ghc-options: -Wno-redundant-constraints
80 default-language: Haskell2010
82 default-language: Haskell2010
81 hs-source-dirs: test, src
83 hs-source-dirs: test, src
82 main-is: Spec.hs
84 main-is: Spec.hs
@@ -110,8 +112,8 @@ test-suite spec
110 , HUnit
112 , HUnit
111 , network >= 2.6
113 , network >= 2.6
112 , QuickCheck >= 2.7
114 , QuickCheck >= 2.7
113− , servant == 0.7.*
115+ , servant == 0.8.*
114− , servant-server == 0.7.*
116+ , servant-server == 0.8.*
115 , text
117 , text
116 , wai
118 , wai
117 , warp
119 , warp
servant-client/src/Servant/Common/Req.hs+8−3
@@ -112,9 +112,8 @@ performRequest :: Method -> Req -> Manager -> BaseUrl
112performRequest reqMethod req manager reqHost = do
112performRequest reqMethod req manager reqHost = do
113 partialRequest <- liftIO $ reqToRequest req reqHost
113 partialRequest <- liftIO $ reqToRequest req reqHost
114
114
115+ let request = disableStatusCheck $
115− let request = partialRequest { Client.method = reqMethod
116+ partialRequest { Client.method = reqMethod }
116− , checkStatus = \ _status _headers _cookies -> Nothing
117− }
118
117
119 eResponse <- liftIO $ performHttpRequest manager request
118 eResponse <- liftIO $ performHttpRequest manager request
120 case eResponse of
119 case eResponse of
@@ -135,6 +134,12 @@ performRequest reqMethod req manager reqHost = do
135 throwE $ FailureResponse status ct body
134 throwE $ FailureResponse status ct body
136 return (status_code, body, ct, hdrs, response)
135 return (status_code, body, ct, hdrs, response)
137
136
137+disableStatusCheck :: Request -> Request
138+#if MIN_VERSION_http_client(0,5,0)
139+disableStatusCheck req = req { checkResponse = \ _req _res -> return () }
140+#else
141+disableStatusCheck req = req { checkStatus = \ _status _headers _cookies -> Nothing }
142+#endif
138
143
139performRequestCT :: MimeUnrender ct result =>
144performRequestCT :: MimeUnrender ct result =>
140 Proxy ct -> Method -> Req -> Manager -> BaseUrl
145 Proxy ct -> Method -> Req -> Manager -> BaseUrl
servant-client/test/ghcjs/testServer/package.yaml+1
@@ -6,6 +6,7 @@ executables:
6 other-modules: []
6 other-modules: []
7 dependencies:
7 dependencies:
8 - base
8 - base
9+ - base-compat
9 - aeson
10 - aeson
10 - base64-bytestring
11 - base64-bytestring
11 - bytestring
12 - bytestring
servant-client/test/ghcjs/testServer/testServer.cabal+2−1
@@ -1,4 +1,4 @@
1−-- This file has been generated from package.yaml by hpack version 0.13.0.
1+-- This file has been generated from package.yaml by hpack version 0.14.0.
2--
2--
3-- see: https://github.com/sol/hpack
3-- see: https://github.com/sol/hpack
4
4
@@ -17,6 +17,7 @@ executable testServer
17 ../../../include
17 ../../../include
18 build-depends:
18 build-depends:
19 base
19 base
20+ , base-compat
20 , aeson
21 , aeson
21 , base64-bytestring
22 , base64-bytestring
22 , bytestring
23 , bytestring
servant-docs/example/greet.hs+2−2
@@ -81,7 +81,7 @@ type TestApi =
81 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] (Headers '[Header "X-Example" Int] Greet)
81 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] (Headers '[Header "X-Example" Int] Greet)
82
82
83 -- DELETE /greet/:greetid
83 -- DELETE /greet/:greetid
84− :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
84+ :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
85
85
86testApi :: Proxy TestApi
86testApi :: Proxy TestApi
87testApi = Proxy
87testApi = Proxy
@@ -91,7 +91,7 @@ testApi = Proxy
91-- notes.
91-- notes.
92extra :: ExtraInfo TestApi
92extra :: ExtraInfo TestApi
93extra =
93extra =
94− extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] ())) $
94+ extraInfo (Proxy :: Proxy ("greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent)) $
95 defAction & headers <>~ ["unicorns"]
95 defAction & headers <>~ ["unicorns"]
96 & notes <>~ [ DocNote "Title" ["This is some text"]
96 & notes <>~ [ DocNote "Title" ["This is some text"]
97 , DocNote "Second secton" ["And some more"]
97 , DocNote "Second secton" ["And some more"]
servant-docs/servant-docs.cabal+2−2
@@ -1,5 +1,5 @@
1name: servant-docs
1name: servant-docs
2−version: 0.7.1
2+version: 0.8
3synopsis: generate API docs for your servant webservice
3synopsis: generate API docs for your servant webservice
4description:
4description:
5 Library for generating API docs from a servant API definition.
5 Library for generating API docs from a servant API definition.
@@ -42,7 +42,7 @@ library
42 , http-media >= 0.6
42 , http-media >= 0.6
43 , http-types >= 0.7
43 , http-types >= 0.7
44 , lens
44 , lens
45− , servant == 0.7.*
45+ , servant == 0.8.*
46 , string-conversions
46 , string-conversions
47 , text
47 , text
48 , unordered-containers
48 , unordered-containers
servant-docs/src/Servant/Docs/Internal.hs+1−1
@@ -833,7 +833,7 @@ instance (ToAuthInfo (BasicAuth realm usr), HasDocs api) => HasDocs (BasicAuth r
833 action' = over authInfo (|> toAuthInfo authProxy) action
833 action' = over authInfo (|> toAuthInfo authProxy) action
834
834
835-- ToSample instances for simple types
835-- ToSample instances for simple types
836−instance ToSample ()
836+instance ToSample NoContent
837instance ToSample Bool
837instance ToSample Bool
838instance ToSample Ordering
838instance ToSample Ordering
839
839
servant-foreign/servant-foreign.cabal+2−2
@@ -1,5 +1,5 @@
1name: servant-foreign
1name: servant-foreign
2−version: 0.7.1
2+version: 0.8
3synopsis: Helpers for generating clients for servant APIs in any programming language
3synopsis: Helpers for generating clients for servant APIs in any programming language
4description:
4description:
5 Helper types and functions for generating client functions for servant APIs in any programming language
5 Helper types and functions for generating client functions for servant APIs in any programming language
@@ -32,7 +32,7 @@ library
32 , Servant.Foreign.Inflections
32 , Servant.Foreign.Inflections
33 build-depends: base == 4.*
33 build-depends: base == 4.*
34 , lens == 4.*
34 , lens == 4.*
35− , servant == 0.7.*
35+ , servant == 0.8.*
36 , text >= 1.2 && < 1.3
36 , text >= 1.2 && < 1.3
37 , http-types
37 , http-types
38 hs-source-dirs: src
38 hs-source-dirs: src
servant-foreign/src/Servant/Foreign/Internal.hs+6−6
@@ -169,11 +169,11 @@ type family Elem (a :: *) (ls::[*]) :: Constraint where
169-- > getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
169-- > getEndpoints api = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy Text) api
170--
170--
171-- > -- If language __X__ is dynamically typed then you can use
171-- > -- 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:
173--
173--
174−-- > getEndpoints :: (HasForeign NoTypes () api, GenerateList Text (Foreign () api))
174+-- > getEndpoints :: (HasForeign NoTypes NoContent api, GenerateList Text (Foreign NoContent api))
175−-- > => Proxy api -> [Req ()]
175+-- > => Proxy api -> [Req NoContent]
176−-- > getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) api
176+-- > getEndpoints api = listFromAPI (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) api
177-- >
177-- >
178--
178--
179class HasForeignType lang ftype a where
179class HasForeignType lang ftype a where
@@ -181,8 +181,8 @@ class HasForeignType lang ftype a where
181
181
182data NoTypes
182data NoTypes
183
183
184−instance HasForeignType NoTypes () ftype where
184+instance HasForeignType NoTypes NoContent ftype where
185− typeFor _ _ _ = ()
185+ typeFor _ _ _ = NoContent
186
186
187class HasForeign lang ftype (api :: *) where
187class HasForeign lang ftype (api :: *) where
188 type Foreign ftype api :: *
188 type Foreign ftype api :: *
servant-foreign/test/Servant/ForeignSpec.hs+4−4
@@ -26,7 +26,7 @@ camelCaseSpec = describe "camelCase" $ do
26
26
27data LangX
27data LangX
28
28
29−instance HasForeignType LangX String () where
29+instance HasForeignType LangX String NoContent where
30 typeFor _ _ _ = "voidX"
30 typeFor _ _ _ = "voidX"
31
31
32instance HasForeignType LangX String Int where
32instance HasForeignType LangX String Int where
@@ -43,9 +43,9 @@ instance OVERLAPPABLE_ HasForeignType LangX String a => HasForeignType LangX Str
43
43
44type TestApi
44type TestApi
45 = "test" :> Header "header" [String] :> QueryFlag "flag" :> Get '[JSON] Int
45 = "test" :> Header "header" [String] :> QueryFlag "flag" :> Get '[JSON] Int
46− :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] ()
46+ :<|> "test" :> QueryParam "param" Int :> ReqBody '[JSON] [String] :> Post '[JSON] NoContent
47− :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] ()
47+ :<|> "test" :> QueryParams "params" Int :> ReqBody '[JSON] String :> Put '[JSON] NoContent
48− :<|> "test" :> Capture "id" Int :> Delete '[JSON] ()
48+ :<|> "test" :> Capture "id" Int :> Delete '[JSON] NoContent
49
49
50testApi :: [Req String]
50testApi :: [Req String]
51testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi)
51testApi = listFromAPI (Proxy :: Proxy LangX) (Proxy :: Proxy String) (Proxy :: Proxy TestApi)
servant-js/servant-js.cabal+5−4
@@ -1,5 +1,5 @@
1name: servant-js
1name: servant-js
2−version: 0.7.1
2+version: 0.8
3synopsis: Automatically derive javascript functions to query servant webservices.
3synopsis: Automatically derive javascript functions to query servant webservices.
4description:
4description:
5 Automatically derive javascript functions to query servant webservices.
5 Automatically derive javascript functions to query servant webservices.
@@ -45,7 +45,8 @@ library
45 , base-compat >= 0.9
45 , base-compat >= 0.9
46 , charset >= 0.3
46 , charset >= 0.3
47 , lens >= 4
47 , lens >= 4
48− , servant-foreign == 0.7.*
48+ , servant-foreign == 0.8.*
49+ , servant == 0.8.*
49 , text >= 1.2 && < 1.3
50 , text >= 1.2 && < 1.3
50
51
51 hs-source-dirs: src
52 hs-source-dirs: src
@@ -67,8 +68,8 @@ executable counter
67 , aeson >= 0.7 && < 0.12
68 , aeson >= 0.7 && < 0.12
68 , filepath >= 1
69 , filepath >= 1
69 , lens >= 4
70 , lens >= 4
70− , servant == 0.7.*
71+ , servant == 0.8.*
71− , servant-server == 0.7.*
72+ , servant-server == 0.8.*
72 , servant-js
73 , servant-js
73 , stm
74 , stm
74 , transformers
75 , transformers
servant-js/src/Servant/JS.hs+6−5
@@ -118,6 +118,7 @@ import Prelude hiding (writeFile)
118import Data.Proxy
118import Data.Proxy
119import Data.Text
119import Data.Text
120import Data.Text.IO (writeFile)
120import Data.Text.IO (writeFile)
121+import Servant.API.ContentTypes
121import Servant.JS.Angular
122import Servant.JS.Angular
122import Servant.JS.Axios
123import Servant.JS.Axios
123import Servant.JS.Internal
124import Servant.JS.Internal
@@ -128,22 +129,22 @@ import Servant.Foreign (listFromAPI)
128-- | Generate the data necessary to generate javascript code
129-- | Generate the data necessary to generate javascript code
129-- for all the endpoints of an API, as ':<|>'-separated values
130-- for all the endpoints of an API, as ':<|>'-separated values
130-- of type 'AjaxReq'.
131-- of type 'AjaxReq'.
131−javascript :: HasForeign NoTypes () api => Proxy api -> Foreign () api
132+javascript :: HasForeign NoTypes NoContent api => Proxy api -> Foreign NoContent api
132−javascript p = foreignFor (Proxy :: Proxy NoTypes) (Proxy :: Proxy ()) p defReq
133+javascript p = foreignFor (Proxy :: Proxy NoTypes) (Proxy :: Proxy NoContent) p defReq
133
134
134-- | Directly generate all the javascript functions for your API
135-- | Directly generate all the javascript functions for your API
135-- from a 'Proxy' for your API type. You can then write it to
136-- from a 'Proxy' for your API type. You can then write it to
136-- a file or integrate it in a page, for example.
137-- 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))
138 => Proxy api -- ^ proxy for your API type
139 => Proxy api -- ^ proxy for your API type
139 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
140 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
140 -> Text -- ^ a text that you can embed in your pages or write to a file
141 -> 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)
142
143
143-- | Directly generate all the javascript functions for your API
144-- | Directly generate all the javascript functions for your API
144-- from a 'Proxy' for your API type using the given generator
145-- from a 'Proxy' for your API type using the given generator
145-- and write the resulting code to a file at the given path.
146-- 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))
147 => Proxy api -- ^ proxy for your API type
148 => Proxy api -- ^ proxy for your API type
148 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
149 -> JavaScriptGenerator -- ^ js code generator to use (angular, vanilla js, jquery, others)
149 -> FilePath -- ^ path to the file you want to write the resulting javascript code into
150 -> 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
54import Data.Text (Text)
54import Data.Text (Text)
55import Servant.Foreign
55import Servant.Foreign
56
56
57−type AjaxReq = Req ()
57+type AjaxReq = Req NoContent
58
58
59-- A 'JavascriptGenerator' just takes the data found in the API type
59-- A 'JavascriptGenerator' just takes the data found in the API type
60-- for each endpoint and generates Javascript code in a Text. Several
60-- for each endpoint and generates Javascript code in a Text. Several
61-- generators are available in this package.
61-- generators are available in this package.
62−type JavaScriptGenerator = [Req ()] -> Text
62+type JavaScriptGenerator = [Req NoContent] -> Text
63
63
64-- | This structure is used by specific implementations to let you
64-- | This structure is used by specific implementations to let you
65-- customize the output
65-- customize the output
servant-js/test/Servant/JSSpec.hs+3−2
@@ -21,6 +21,7 @@ import Prelude.Compat
21import Test.Hspec hiding (shouldContain, shouldNotContain)
21import Test.Hspec hiding (shouldContain, shouldNotContain)
22
22
23import Servant.API.Internal.Test.ComprehensiveAPI
23import Servant.API.Internal.Test.ComprehensiveAPI
24+import Servant.API.ContentTypes
24import Servant.JS
25import Servant.JS
25import Servant.JS.Internal
26import Servant.JS.Internal
26import qualified Servant.JS.Angular as NG
27import qualified Servant.JS.Angular as NG
@@ -105,7 +106,7 @@ a `shouldNotContain` b = shouldNotSatisfy a (T.isInfixOf b)
105
106
106axiosSpec :: Spec
107axiosSpec :: Spec
107axiosSpec = describe specLabel $ do
108axiosSpec = 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)
109 it "should add withCredentials when needed" $ do
110 it "should add withCredentials when needed" $ do
110 let jsText = genJS withCredOpts $ reqList
111 let jsText = genJS withCredOpts $ reqList
111 output jsText
112 output jsText
@@ -129,7 +130,7 @@ axiosSpec = describe specLabel $ do
129
130
130angularSpec :: TestNames -> Spec
131angularSpec :: TestNames -> Spec
131angularSpec test = describe specLabel $ do
132angularSpec 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)
133 it "should implement a service globally" $ do
134 it "should implement a service globally" $ do
134 let jsText = genJS reqList
135 let jsText = genJS reqList
135 output jsText
136 output jsText
servant-js/test/Servant/JSSpec/CustomHeaders.hs+13−12
@@ -16,6 +16,7 @@ import Data.Monoid
16import Data.Proxy
16import Data.Proxy
17import Data.Text (pack)
17import Data.Text (pack)
18import GHC.TypeLits
18import GHC.TypeLits
19+import Servant.API.ContentTypes
19import Servant.JS.Internal
20import Servant.JS.Internal
20
21
21-- | This is a hypothetical combinator that fetches an Authorization header.
22-- | This is a hypothetical combinator that fetches an Authorization header.
@@ -23,13 +24,13 @@ import Servant.JS.Internal
23-- using -- Basic, Digest, whatever.
24-- using -- Basic, Digest, whatever.
24data Authorization (sym :: Symbol) a
25data Authorization (sym :: Symbol) a
25
26
26−instance (KnownSymbol sym, HasForeign lang () api)
27+instance (KnownSymbol sym, HasForeign lang NoContent api)
27− => HasForeign lang () (Authorization sym a :> api) where
28+ => HasForeign lang NoContent (Authorization sym a :> api) where
28− type Foreign () (Authorization sym a :> api) = Foreign () api
29+ type Foreign NoContent (Authorization sym a :> api) = Foreign NoContent api
29
30
30 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
31 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
31 req & reqHeaders <>~
32 req & reqHeaders <>~
32− [ ReplaceHeaderArg (Arg "Authorization" ())
33+ [ ReplaceHeaderArg (Arg "Authorization" NoContent)
33 $ tokenType (pack . symbolVal $ (Proxy :: Proxy sym)) ]
34 $ tokenType (pack . symbolVal $ (Proxy :: Proxy sym)) ]
34 where
35 where
35 tokenType t = t <> " {Authorization}"
36 tokenType t = t <> " {Authorization}"
@@ -37,23 +38,23 @@ instance (KnownSymbol sym, HasForeign lang () api)
37-- | This is a combinator that fetches an X-MyLovelyHorse header.
38-- | This is a combinator that fetches an X-MyLovelyHorse header.
38data MyLovelyHorse a
39data MyLovelyHorse a
39
40
40−instance (HasForeign lang () api)
41+instance (HasForeign lang NoContent api)
41− => HasForeign lang () (MyLovelyHorse a :> api) where
42+ => HasForeign lang NoContent (MyLovelyHorse a :> api) where
42− type Foreign () (MyLovelyHorse a :> api) = Foreign () api
43+ type Foreign NoContent (MyLovelyHorse a :> api) = Foreign NoContent api
43
44
44 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
45 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 ]
46 where
47 where
47 tpl = "I am good friends with {X-MyLovelyHorse}"
48 tpl = "I am good friends with {X-MyLovelyHorse}"
48
49
49-- | This is a combinator that fetches an X-WhatsForDinner header.
50-- | This is a combinator that fetches an X-WhatsForDinner header.
50data WhatsForDinner a
51data WhatsForDinner a
51
52
52−instance (HasForeign lang () api)
53+instance (HasForeign lang NoContent api)
53− => HasForeign lang () (WhatsForDinner a :> api) where
54+ => HasForeign lang NoContent (WhatsForDinner a :> api) where
54− type Foreign () (WhatsForDinner a :> api) = Foreign () api
55+ type Foreign NoContent (WhatsForDinner a :> api) = Foreign NoContent api
55
56
56 foreignFor lang ftype Proxy req = foreignFor lang ftype (Proxy :: Proxy api) $
57 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 ]
58 where
59 where
59 tpl = "I would like {X-WhatsForDinner} with a cherry on top."
60 tpl = "I would like {X-WhatsForDinner} with a cherry on top."
servant-mock/servant-mock.cabal+3−3
@@ -1,5 +1,5 @@
1name: servant-mock
1name: servant-mock
2−version: 0.7.1
2+version: 0.8
3synopsis: Derive a mock server for free from your servant API types
3synopsis: Derive a mock server for free from your servant API types
4description:
4description:
5 Derive a mock server for free from your servant API types
5 Derive a mock server for free from your servant API types
@@ -31,8 +31,8 @@ library
31 base >=4.7 && <5,
31 base >=4.7 && <5,
32 bytestring >= 0.10 && <0.11,
32 bytestring >= 0.10 && <0.11,
33 http-types >= 0.8 && <0.10,
33 http-types >= 0.8 && <0.10,
34− servant == 0.7.*,
34+ servant == 0.8.*,
35− servant-server == 0.7.*,
35+ servant-server == 0.8.*,
36 transformers >= 0.3 && <0.6,
36 transformers >= 0.3 && <0.6,
37 QuickCheck >= 2.7 && <2.9,
37 QuickCheck >= 2.7 && <2.9,
38 wai >= 3.0 && <3.3
38 wai >= 3.0 && <3.3
servant-mock/src/Servant/Mock.hs+3
@@ -180,3 +180,6 @@ instance Arbitrary (HList '[]) where
180instance (Arbitrary a, Arbitrary (HList hs))
180instance (Arbitrary a, Arbitrary (HList hs))
181 => Arbitrary (HList (Header h a ': hs)) where
181 => Arbitrary (HList (Header h a ': hs)) where
182 arbitrary = HCons <$> fmap Header arbitrary <*> arbitrary
182 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 =
34 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
34 :<|> "greet" :> ReqBody '[JSON] Greet :> Post '[JSON] Greet
35
35
36 -- DELETE /greet/:greetid
36 -- DELETE /greet/:greetid
37− :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] ()
37+ :<|> "greet" :> Capture "greetid" Text :> Delete '[JSON] NoContent
38
38
39testApi :: Proxy TestApi
39testApi :: Proxy TestApi
40testApi = Proxy
40testApi = Proxy
@@ -54,7 +54,7 @@ server = helloH :<|> postGreetH :<|> deleteGreetH
54
54
55 postGreetH greet = return greet
55 postGreetH greet = return greet
56
56
57− deleteGreetH _ = return ()
57+ deleteGreetH _ = return NoContent
58
58
59-- Turn the server into a WAI app. 'serve' is provided by servant,
59-- Turn the server into a WAI app. 'serve' is provided by servant,
60-- more precisely by the Servant.Server module.
60-- more precisely by the Servant.Server module.
servant-server/servant-server.cabal+9−9
@@ -1,5 +1,5 @@
1name: servant-server
1name: servant-server
2−version: 0.7.1
2+version: 0.8
3synopsis: A family of combinators for defining webservices APIs and serving them
3synopsis: A family of combinators for defining webservices APIs and serving them
4description:
4description:
5 A family of combinators for defining webservices APIs and serving them
5 A family of combinators for defining webservices APIs and serving them
@@ -45,31 +45,31 @@ library
45 Servant.Server.Internal.ServantErr
45 Servant.Server.Internal.ServantErr
46 Servant.Utils.StaticFiles
46 Servant.Utils.StaticFiles
47 build-depends:
47 build-depends:
48− base >= 4.7 && < 5
48+ base >= 4.7 && < 4.10
49− , base-compat >= 0.9
49+ , base-compat >= 0.9 && < 0.10
50 , aeson >= 0.7 && < 0.12
50 , aeson >= 0.7 && < 0.12
51 , attoparsec >= 0.12 && < 0.14
51 , attoparsec >= 0.12 && < 0.14
52− , base64-bytestring == 1.0.*
52+ , base64-bytestring >= 1.0 && < 1.1
53 , bytestring >= 0.10 && < 0.11
53 , bytestring >= 0.10 && < 0.11
54 , containers >= 0.5 && < 0.6
54 , containers >= 0.5 && < 0.6
55 , http-api-data >= 0.1 && < 0.3
55 , http-api-data >= 0.1 && < 0.3
56 , http-types >= 0.8 && < 0.10
56 , http-types >= 0.8 && < 0.10
57 , network-uri >= 2.6 && < 2.7
57 , network-uri >= 2.6 && < 2.7
58− , mtl >= 2 && < 3
58+ , mtl >= 2 && < 2.3
59 , network >= 2.6 && < 2.7
59 , network >= 2.6 && < 2.7
60 , safe >= 0.3 && < 0.4
60 , safe >= 0.3 && < 0.4
61− , servant == 0.7.*
61+ , servant == 0.8.*
62 , split >= 0.2 && < 0.3
62 , split >= 0.2 && < 0.3
63 , string-conversions >= 0.3 && < 0.5
63 , string-conversions >= 0.3 && < 0.5
64 , system-filepath >= 0.4 && < 0.5
64 , system-filepath >= 0.4 && < 0.5
65− , filepath >= 1
65+ , filepath >= 1 && < 1.5
66 , text >= 1.2 && < 1.3
66 , text >= 1.2 && < 1.3
67 , transformers >= 0.3 && < 0.6
67 , transformers >= 0.3 && < 0.6
68− , transformers-compat>= 0.4
68+ , transformers-compat>= 0.4 && < 0.6
69 , wai >= 3.0 && < 3.3
69 , wai >= 3.0 && < 3.3
70 , wai-app-static >= 3.1 && < 3.2
70 , wai-app-static >= 3.1 && < 3.2
71 , warp >= 3.0 && < 3.3
71 , warp >= 3.0 && < 3.3
72− , word8 == 0.1.*
72+ , word8 >= 0.1 && < 0.2
73
73
74 hs-source-dirs: src
74 hs-source-dirs: src
75 default-language: Haskell2010
75 default-language: Haskell2010
servant-server/src/Servant/Server.hs+1−1
@@ -147,7 +147,7 @@ serveWithContext p context server =
147-- For the following API
147-- For the following API
148--
148--
149-- > type API =
149-- > type API =
150−-- > "a" :> "d" :> Get '[JSON] ()
150+-- > "a" :> "d" :> Get '[JSON] NoContent
151-- > :<|> "b" :> Capture "x" Int :> Get '[JSON] Bool
151-- > :<|> "b" :> Capture "x" Int :> Get '[JSON] Bool
152-- > :<|> "c" :> Put '[JSON] Bool
152-- > :<|> "c" :> Put '[JSON] Bool
153-- > :<|> "a" :> "e" :> Get '[JSON] Int
153-- > :<|> "a" :> "e" :> Get '[JSON] Int
servant-server/test/Servant/Server/RouterSpec.hs+1−1
@@ -74,7 +74,7 @@ makeTrivialRouter :: (HasServer layout '[]) => Proxy layout -> Router ()
74makeTrivialRouter p =
74makeTrivialRouter p =
75 route p EmptyContext (emptyDelayed (FailFatal err501))
75 route p EmptyContext (emptyDelayed (FailFatal err501))
76
76
77−type End = Get '[JSON] ()
77+type End = Get '[JSON] NoContent
78
78
79-- The latter version looks more efficient,
79-- The latter version looks more efficient,
80-- but the former should be compiled to the
80-- 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
340-- * headerSpec {{{
340-- * headerSpec {{{
341------------------------------------------------------------------------------
341------------------------------------------------------------------------------
342
342
343−type HeaderApi a = Header "MyHeader" a :> Delete '[JSON] ()
343+type HeaderApi a = Header "MyHeader" a :> Delete '[JSON] NoContent
344headerApi :: Proxy (HeaderApi a)
344headerApi :: Proxy (HeaderApi a)
345headerApi = Proxy
345headerApi = Proxy
346
346
347headerSpec :: Spec
347headerSpec :: Spec
348headerSpec = describe "Servant.API.Header" $ do
348headerSpec = describe "Servant.API.Header" $ do
349
349
350− let expectsInt :: Maybe Int -> Handler ()
350+ let expectsInt :: Maybe Int -> Handler NoContent
351+ expectsInt (Just x) = do
351− expectsInt (Just x) = when (x /= 5) $ error "Expected 5"
352+ when (x /= 5) $ error "Expected 5"
353+ return NoContent
352 expectsInt Nothing = error "Expected an int"
354 expectsInt Nothing = error "Expected an int"
353
355
354− let expectsString :: Maybe String -> Handler ()
356+ let expectsString :: Maybe String -> Handler NoContent
357+ expectsString (Just x) = do
355− expectsString (Just x) = when (x /= "more from you") $ error "Expected more from you"
358+ when (x /= "more from you") $ error "Expected more from you"
359+ return NoContent
356 expectsString Nothing = error "Expected a string"
360 expectsString Nothing = error "Expected a string"
357
361
358 with (return (serve headerApi expectsInt)) $ do
362 with (return (serve headerApi expectsInt)) $ do
@@ -410,7 +414,7 @@ type AlternativeApi =
410 :<|> "foo" :> Get '[PlainText] T.Text
414 :<|> "foo" :> Get '[PlainText] T.Text
411 :<|> "bar" :> Post '[JSON] Animal
415 :<|> "bar" :> Post '[JSON] Animal
412 :<|> "bar" :> Put '[JSON] Animal
416 :<|> "bar" :> Put '[JSON] Animal
413− :<|> "bar" :> Delete '[JSON] ()
417+ :<|> "bar" :> Delete '[JSON] NoContent
414
418
415alternativeApi :: Proxy AlternativeApi
419alternativeApi :: Proxy AlternativeApi
416alternativeApi = Proxy
420alternativeApi = Proxy
@@ -422,7 +426,7 @@ alternativeServer =
422 :<|> return "a string"
426 :<|> return "a string"
423 :<|> return jerry
427 :<|> return jerry
424 :<|> return jerry
428 :<|> return jerry
425− :<|> return ()
429+ :<|> return NoContent
426
430
427alternativeSpec :: Spec
431alternativeSpec :: Spec
428alternativeSpec = do
432alternativeSpec = do
servant/CHANGELOG.md+5
@@ -1,3 +1,8 @@
1+0.8
2+---
3+
4+* Minor fixes, documentation changes and cabal tweaks
5+
10.7.1
60.7.1
2-----
7-----
3
8
servant/servant.cabal+17−17
@@ -1,5 +1,5 @@
1name: servant
1name: servant
2−version: 0.7.1
2+version: 0.8
3synopsis: A family of combinators for defining webservices APIs
3synopsis: A family of combinators for defining webservices APIs
4description:
4description:
5 A family of combinators for defining webservices APIs and serving them
5 A family of combinators for defining webservices APIs and serving them
@@ -49,22 +49,22 @@ library
49 Servant.Utils.Links
49 Servant.Utils.Links
50 Servant.Utils.Enter
50 Servant.Utils.Enter
51 build-depends:
51 build-depends:
52− base >= 4.7 && < 4.10
52+ base >= 4.7 && < 4.10
53− , base-compat >= 0.9
53+ , base-compat >= 0.9 && < 0.10
54− , aeson >= 0.7
54+ , aeson >= 0.7 && < 0.12
55− , attoparsec >= 0.12
55+ , attoparsec >= 0.12 && < 0.14
56− , bytestring == 0.10.*
56+ , bytestring >= 0.10 && < 0.11
57− , bytestring-conversion == 0.3.*
57+ , bytestring-conversion >= 0.3 && < 0.4
58− , case-insensitive >= 1.2
58+ , case-insensitive >= 1.2 && < 1.3
59− , http-api-data >= 0.1 && < 0.3
59+ , http-api-data >= 0.1 && < 0.3
60− , http-media >= 0.4 && < 0.7
60+ , http-media >= 0.4 && < 0.7
61− , http-types >= 0.8 && < 0.10
61+ , http-types >= 0.8 && < 0.10
62− , mtl >= 2 && < 3
62+ , mtl >= 2.0 && < 2.3
63− , mmorph >= 1
63+ , mmorph >= 1 && < 1.1
64− , text >= 1 && < 2
64+ , text >= 1 && < 1.3
65− , string-conversions >= 0.3 && < 0.5
65+ , string-conversions >= 0.3 && < 0.5
66− , network-uri >= 2.6
66+ , network-uri >= 2.6 && < 2.7
67− , vault >= 0.3 && <0.4
67+ , vault >= 0.3 && < 0.4
68 hs-source-dirs: src
68 hs-source-dirs: src
69 default-language: Haskell2010
69 default-language: Haskell2010
70 other-extensions: CPP
70 other-extensions: CPP
servant/src/Servant/API/ContentTypes.hs+1−1
@@ -319,7 +319,7 @@ instance MimeRender OctetStream BS.ByteString where
319
319
320-- | A type for responses without content-body.
320-- | A type for responses without content-body.
321data NoContent = NoContent
321data NoContent = NoContent
322− deriving (Show, Eq, Read)
322+ deriving (Show, Eq, Read, Generic)
323
323
324
324
325--------------------------------------------------------------------------
325--------------------------------------------------------------------------
servant/src/Servant/API/Internal/Test/ComprehensiveAPI.hs+3−3
@@ -10,7 +10,7 @@ import Data.Proxy
10
10
11import Servant.API
11import Servant.API
12
12
13−type GET = Get '[JSON] ()
13+type GET = Get '[JSON] NoContent
14
14
15type ComprehensiveAPI =
15type ComprehensiveAPI =
16 GET :<|>
16 GET :<|>
@@ -25,10 +25,10 @@ type ComprehensiveAPI =
25-- Raw :<|>
25-- Raw :<|>
26 RemoteHost :> GET :<|>
26 RemoteHost :> GET :<|>
27 ReqBody '[JSON] Int :> GET :<|>
27 ReqBody '[JSON] Int :> GET :<|>
28− Get '[JSON] (Headers '[Header "foo" Int] ()) :<|>
28+ Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|>
29 "foo" :> GET :<|>
29 "foo" :> GET :<|>
30 Vault :> GET :<|>
30 Vault :> GET :<|>
31− Verb 'POST 204 '[JSON] () :<|>
31+ Verb 'POST 204 '[JSON] NoContent :<|>
32 Verb 'POST 204 '[JSON] Int :<|>
32 Verb 'POST 204 '[JSON] Int :<|>
33 WithNamedContext "foo" '[] GET
33 WithNamedContext "foo" '[] GET
34
34
servant/src/Servant/Utils/Links.hs+4−4
@@ -21,7 +21,7 @@
21-- >>>
21-- >>>
22-- >>>
22-- >>>
23-- >>> type Hello = "hello" :> Get '[JSON] Int
23-- >>> 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
25-- >>> type API = Hello :<|> Bye
25-- >>> type API = Hello :<|> Bye
26-- >>> let api = Proxy :: Proxy API
26-- >>> let api = Proxy :: Proxy API
27--
27--
@@ -47,11 +47,11 @@
47-- If the API has an endpoint with parameters then we can generate links with
47-- If the API has an endpoint with parameters then we can generate links with
48-- or without those:
48-- or without those:
49--
49--
50−-- >>> let with = Proxy :: Proxy ("bye" :> QueryParam "name" String :> Delete '[JSON] ())
50+-- >>> let with = Proxy :: Proxy ("bye" :> QueryParam "name" String :> Delete '[JSON] NoContent)
51-- >>> print $ safeLink api with (Just "Hubert")
51-- >>> print $ safeLink api with (Just "Hubert")
52-- bye?name=Hubert
52-- bye?name=Hubert
53--
53--
54−-- >>> let without = Proxy :: Proxy ("bye" :> Delete '[JSON] ())
54+-- >>> let without = Proxy :: Proxy ("bye" :> Delete '[JSON] NoContent)
55-- >>> print $ safeLink api without
55-- >>> print $ safeLink api without
56-- bye
56-- bye
57--
57--
@@ -69,7 +69,7 @@
69-- Attempting to construct a link to an endpoint that does not exist in api
69-- Attempting to construct a link to an endpoint that does not exist in api
70-- will result in a type error like this:
70-- will result in a type error like this:
71--
71--
72−-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] ())
72+-- >>> let bad_link = Proxy :: Proxy ("hello" :> Delete '[JSON] NoContent)
73-- >>> safeLink api bad_link
73-- >>> safeLink api bad_link
74-- ...
74-- ...
75-- ...Could not deduce...
75-- ...Could not deduce...
servant/test/Servant/Utils/LinksSpec.hs+17−17
@@ -12,16 +12,16 @@ import Servant.API
12
12
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
16
16
17 -- Flags
17 -- Flags
18− :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] ()
18+ :<|> "balls" :> QueryFlag "bouncy" :> QueryFlag "fast" :> Delete '[JSON] NoContent
19
19
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
26
26
27
27
@@ -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"
43
43
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"
48
48
49
49
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"
55
55
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"
62
62
63
63
@@ -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)
95-- get
95-- get
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