on master help sign in
Merge pull request #11 from anchor/patch-method
648dc2fJulian Arni
servant.cabal+1
@@ -31,6 +31,7 @@ library
31 Servant.API.Delete
31 Servant.API.Delete
32 Servant.API.Get
32 Servant.API.Get
33 Servant.API.Header
33 Servant.API.Header
34+ Servant.API.Patch
34 Servant.API.Post
35 Servant.API.Post
35 Servant.API.Put
36 Servant.API.Put
36 Servant.API.QueryParam
37 Servant.API.QueryParam
src/Servant/API.hs+3
@@ -27,6 +27,8 @@ module Servant.API (
27 module Servant.API.Delete,
27 module Servant.API.Delete,
28 -- | PUT requests
28 -- | PUT requests
29 module Servant.API.Put,
29 module Servant.API.Put,
30+ -- | PATCH requests
31+ module Servant.API.Patch,
30
32
31 -- * Untyped endpoints
33 -- * Untyped endpoints
32 -- | Plugging in a wai 'Network.Wai.Application', serving directories
34 -- | Plugging in a wai 'Network.Wai.Application', serving directories
@@ -46,6 +48,7 @@ import Servant.API.Get ( Get )
46import Servant.API.Header ( Header )
48import Servant.API.Header ( Header )
47import Servant.API.Post ( Post )
49import Servant.API.Post ( Post )
48import Servant.API.Put ( Put )
50import Servant.API.Put ( Put )
51+import Servant.API.Patch ( Patch )
49import Servant.API.QueryParam ( QueryFlag, QueryParams, QueryParam )
52import Servant.API.QueryParam ( QueryFlag, QueryParams, QueryParam )
50import Servant.API.MatrixParam ( MatrixFlag, MatrixParams, MatrixParam )
53import Servant.API.MatrixParam ( MatrixFlag, MatrixParams, MatrixParam )
51import Servant.API.Raw ( Raw )
54import Servant.API.Raw ( Raw )
src/Servant/API/Patch.hsnew file+19
@@ -0,0 +1,19 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
2+module Servant.API.Patch where
3+
4+import Data.Typeable ( Typeable )
5+
6+-- | Endpoint for PATCH requests. The type variable represents the type of the
7+-- response body (not the request body, use 'Servant.API.ReqBody.ReqBody' for
8+-- that).
9+--
10+-- If the HTTP response is empty, only () is supported.
11+--
12+-- Example:
13+--
14+-- > -- POST /books
15+-- > -- with a JSON encoded Book as the request body
16+-- > -- returning the just-created Book
17+-- > type MyApi = "books" :> ReqBody Book :> Post Book
18+data Patch a
19+ deriving Typeable