@@ -3,7 +3,7 @@
3{-# LANGUAGE TypeOperators #-}
3{-# LANGUAGE TypeOperators #-}
4{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FlexibleInstances #-}
5{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ScopedTypeVariables #-}
6−module Servant.API.RQBody where
6+module Servant.API.JsonBody where
8import Control.Applicative
8import Control.Applicative
9import Data.Aeson
9import Data.Aeson
@@ -15,12 +15,12 @@ import Servant.Docs
15import Servant.Server
15import Servant.Server
17-- * Request Body support
17-- * Request Body support
18−data RQBody a
18+data JsonBody a
20instance (FromJSON a, HasServer sublayout)
20instance (FromJSON a, HasServer sublayout)
21− => HasServer (RQBody a :> sublayout) where
21+ => HasServer (JsonBody a :> sublayout) where
23− type Server (RQBody a :> sublayout) =
23+ type Server (JsonBody a :> sublayout) =
24 a -> Server sublayout
24 a -> Server sublayout
26 route Proxy subserver request respond = do
26 route Proxy subserver request respond = do
@@ -30,9 +30,9 @@ instance (FromJSON a, HasServer sublayout)
30 Just v -> route (Proxy :: Proxy sublayout) (subserver v) request respond
30 Just v -> route (Proxy :: Proxy sublayout) (subserver v) request respond
32instance (ToJSON a, HasClient sublayout)
32instance (ToJSON a, HasClient sublayout)
33− => HasClient (RQBody a :> sublayout) where
33+ => HasClient (JsonBody a :> sublayout) where
35− type Client (RQBody a :> sublayout) =
35+ type Client (JsonBody a :> sublayout) =
36 a -> Client sublayout
36 a -> Client sublayout
38 clientWithRoute Proxy req body =
38 clientWithRoute Proxy req body =
@@ -40,7 +40,7 @@ instance (ToJSON a, HasClient sublayout)
40 setRQBody (encode body) req
40 setRQBody (encode body) req
42instance (ToSample a, HasDocs sublayout)
42instance (ToSample a, HasDocs sublayout)
43− => HasDocs (RQBody a :> sublayout) where
43+ => HasDocs (JsonBody a :> sublayout) where
45 docsFor Proxy (endpoint, action) =
45 docsFor Proxy (endpoint, action) =
46 docsFor sublayoutP (endpoint, action')
46 docsFor sublayoutP (endpoint, action')