Merge pull request #1024 from messis/add-PutCreated-verb

Add put created verb
This commit is contained in:
Oleg Grenrus 2018-08-16 20:13:09 +03:00 committed by GitHub
commit 46973b7ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -130,7 +130,7 @@ import Servant.API.Verbs
Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative, Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,
Post, PostAccepted, PostCreated, PostNoContent, Post, PostAccepted, PostCreated, PostNoContent,
PostNonAuthoritative, PostResetContent, Put, PutAccepted, PostNonAuthoritative, PostResetContent, Put, PutAccepted,
PutNoContent, PutNonAuthoritative, PutCreated, PutNoContent, PutNonAuthoritative,
ReflectMethod (reflectMethod), StdMethod (..), Verb) ReflectMethod (reflectMethod), StdMethod (..), Verb)
import Servant.API.WithNamedContext import Servant.API.WithNamedContext
(WithNamedContext) (WithNamedContext)

View File

@ -56,14 +56,17 @@ type Patch = Verb 'PATCH 200
-- Indicates that a new resource has been created. The URI corresponding to the -- Indicates that a new resource has been created. The URI corresponding to the
-- resource should be given in the @Location@ header field. -- resource should be given in the @Location@ header field.
-- --
-- If the operation is idempotent, use 'PutCreated'. If not, use 'PostCreated'
--
-- If the resource cannot be created immediately, use 'PostAccepted'. -- If the resource cannot be created immediately, use 'PostAccepted'.
-- --
-- Consider using 'Servant.Links.safeLink' for the @Location@ header -- Consider using 'Servant.Links.safeLink' for the @Location@ header
-- field. -- field.
-- | 'POST' with 201 status code. -- | 'POST' with 201 status code.
--
type PostCreated = Verb 'POST 201 type PostCreated = Verb 'POST 201
-- | 'PUT' with 201 status code.
type PutCreated = Verb 'PUT 201
-- ** 202 Accepted -- ** 202 Accepted