on master help sign in
Merge pull request #11 from anchor/patch-method

Patch method

commit648dc2f2fb53b09bb06e8f526d6724ba1f624f9e authorJulian Arni <jkarni@gmail.com> dateSun 15 Feb 2015, 00:59 (12 years ago) parentb27e2567101174
3 files changed+23
servant.cabal+1 src/Servant/API.hs+3 src/Servant/API/Patch.hs+19
servant.cabal+1
@@ -31,6 +31,7 @@ library
3131 Servant.API.Delete
3232 Servant.API.Get
3333 Servant.API.Header
34+ Servant.API.Patch
3435 Servant.API.Post
3536 Servant.API.Put
3637 Servant.API.QueryParam
src/Servant/API.hs+3
@@ -27,6 +27,8 @@ module Servant.API (
2727 module Servant.API.Delete,
2828 -- | PUT requests
2929 module Servant.API.Put,
30+ -- | PATCH requests
31+ module Servant.API.Patch,
3032
3133 -- * Untyped endpoints
3234 -- | Plugging in a wai 'Network.Wai.Application', serving directories
@@ -46,6 +48,7 @@ import Servant.API.Get ( Get )
4648import Servant.API.Header ( Header )
4749import Servant.API.Post ( Post )
4850import Servant.API.Put ( Put )
51+import Servant.API.Patch ( Patch )
4952import Servant.API.QueryParam ( QueryFlag, QueryParams, QueryParam )
5053import Servant.API.MatrixParam ( MatrixFlag, MatrixParams, MatrixParam )
5154import 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