on master help sign in
rename JsonBody to ReqBody
commit82a7428507a2b08506f49a00669b7210c2035db7 authorAlp Mestanogullari <alpmestan@gmail.com> dateTue 28 Oct 2014, 16:29 (12 years ago) parent9b375b1
4 files changed+12−12
example/greet.hs+1−1 servant.cabal+1−1 src/Servant/API.hs+3−3 src/Servant/API/JsonBody.hs → src/Servant/API/ReqBody.hs+7−7
example/greet.hs+1−1
@@ -51,7 +51,7 @@ instance ToSample Greet where
5151-- API specification
5252type TestApi =
5353 "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
54− :<|> "greet" :> JsonBody Greet :> Post Greet
54+ :<|> "greet" :> ReqBody Greet :> Post Greet
5555 :<|> "delete" :> Capture "greetid" Text :> Delete
5656
5757testApi :: Proxy TestApi
servant.cabal+1−1
@@ -22,10 +22,10 @@ library
2222 Servant.API.Capture
2323 Servant.API.Delete
2424 Servant.API.Get
25− Servant.API.JsonBody
2625 Servant.API.Post
2726 Servant.API.Put
2827 Servant.API.QueryParam
28+ Servant.API.ReqBody
2929 Servant.API.Raw
3030 Servant.API.Sub
3131 Servant.API.Union
src/Servant/API.hs+3−3
@@ -9,10 +9,10 @@ module Servant.API (
99 -- * Accessing information from the request
1010 -- | Capturing parts of the url path as parsed values: @'Capture'@
1111 module Servant.API.Capture,
12− -- | Accessing the request body as a JSON-encoded type: @'JsonBody'@
13− module Servant.API.JsonBody,
1412 -- | Retrieving parameters from the query string of the 'URI': @'QueryParam'@
1513 module Servant.API.QueryParam,
14+ -- | Accessing the request body as a JSON-encoded type: @'ReqBody'@
15+ module Servant.API.ReqBody,
1616
1717 -- * Actual endpoints, distinguished by HTTP method
1818 -- | GET requests
@@ -28,9 +28,9 @@ module Servant.API (
2828import Servant.API.Capture
2929import Servant.API.Delete
3030import Servant.API.Get
31−import Servant.API.JsonBody
3231import Servant.API.Post
3332import Servant.API.Put
3433import Servant.API.QueryParam
34+import Servant.API.ReqBody
3535import Servant.API.Sub
3636import Servant.API.Union
src/Servant/API/JsonBody.hs → src/Servant/API/ReqBody.hsrenamed+7−7
@@ -3,7 +3,7 @@
33{-# LANGUAGE TypeOperators #-}
44{-# LANGUAGE FlexibleInstances #-}
55{-# LANGUAGE ScopedTypeVariables #-}
6−module Servant.API.JsonBody where
6+module Servant.API.ReqBody where
77
88import Control.Applicative
99import Data.Aeson
@@ -15,12 +15,12 @@ import Servant.Docs
1515import Servant.Server
1616
1717-- * Request Body support
18−data JsonBody a
18+data ReqBody a
1919
2020instance (FromJSON a, HasServer sublayout)
21− => HasServer (JsonBody a :> sublayout) where
21+ => HasServer (ReqBody a :> sublayout) where
2222
23− type Server (JsonBody a :> sublayout) =
23+ type Server (ReqBody a :> sublayout) =
2424 a -> Server sublayout
2525
2626 route Proxy subserver request respond = do
@@ -30,9 +30,9 @@ instance (FromJSON a, HasServer sublayout)
3030 Just v -> route (Proxy :: Proxy sublayout) (subserver v) request respond
3131
3232instance (ToJSON a, HasClient sublayout)
33− => HasClient (JsonBody a :> sublayout) where
33+ => HasClient (ReqBody a :> sublayout) where
3434
35− type Client (JsonBody a :> sublayout) =
35+ type Client (ReqBody a :> sublayout) =
3636 a -> Client sublayout
3737
3838 clientWithRoute Proxy req body =
@@ -40,7 +40,7 @@ instance (ToJSON a, HasClient sublayout)
4040 setRQBody (encode body) req
4141
4242instance (ToSample a, HasDocs sublayout)
43− => HasDocs (JsonBody a :> sublayout) where
43+ => HasDocs (ReqBody a :> sublayout) where
4444
4545 docsFor Proxy (endpoint, action) =
4646 docsFor sublayoutP (endpoint, action')