on master help sign in
Add PutCreated verb
13b521emessis
servant/src/Servant/API.hs+2−2
@@ -127,10 +127,10 @@ import Servant.API.Verbs
127 (Delete, DeleteAccepted, DeleteNoContent,
127 (Delete, DeleteAccepted, DeleteNoContent,
128 DeleteNonAuthoritative, Get, GetAccepted, GetNoContent,
128 DeleteNonAuthoritative, Get, GetAccepted, GetNoContent,
129 GetNonAuthoritative, GetPartialContent, GetResetContent,
129 GetNonAuthoritative, GetPartialContent, GetResetContent,
130− Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,
130+ Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,C
131 Post, PostAccepted, PostCreated, PostNoContent,
131 Post, PostAccepted, PostCreated, PostNoContent,
132 PostNonAuthoritative, PostResetContent, Put, PutAccepted,
132 PostNonAuthoritative, PostResetContent, Put, PutAccepted,
133− PutNoContent, PutNonAuthoritative,
133+ PutCreated, PutNoContent, PutNonAuthoritative,
134 ReflectMethod (reflectMethod), StdMethod (..), Verb)
134 ReflectMethod (reflectMethod), StdMethod (..), Verb)
135import Servant.API.WithNamedContext
135import Servant.API.WithNamedContext
136 (WithNamedContext)
136 (WithNamedContext)
servant/src/Servant/API/Verbs.hs+4−1
@@ -56,14 +56,17 @@ type Patch = Verb 'PATCH 200
56-- Indicates that a new resource has been created. The URI corresponding to the
56-- Indicates that a new resource has been created. The URI corresponding to the
57-- resource should be given in the @Location@ header field.
57-- resource should be given in the @Location@ header field.
58--
58--
59+-- If the operation is idempotent, use 'PutCreated'. If not, use 'PostCreated'
60+--
59-- If the resource cannot be created immediately, use 'PostAccepted'.
61-- If the resource cannot be created immediately, use 'PostAccepted'.
60--
62--
61-- Consider using 'Servant.Links.safeLink' for the @Location@ header
63-- Consider using 'Servant.Links.safeLink' for the @Location@ header
62-- field.
64-- field.
63
65
64-- | 'POST' with 201 status code.
66-- | 'POST' with 201 status code.
65−--
66type PostCreated = Verb 'POST 201
67type PostCreated = Verb 'POST 201
68+-- | 'PUT' with 201 status code.
69+type PutCreated = Verb 'PUT 201
67
70
68
71
69-- ** 202 Accepted
72-- ** 202 Accepted