From 13b521eb9004319b0e74b7b2c2a16a0017cf300b Mon Sep 17 00:00:00 2001 From: messis Date: Mon, 13 Aug 2018 15:15:45 +0200 Subject: [PATCH] Add PutCreated verb --- servant/src/Servant/API.hs | 4 ++-- servant/src/Servant/API/Verbs.hs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/servant/src/Servant/API.hs b/servant/src/Servant/API.hs index 21a81234..680435de 100644 --- a/servant/src/Servant/API.hs +++ b/servant/src/Servant/API.hs @@ -127,10 +127,10 @@ import Servant.API.Verbs (Delete, DeleteAccepted, DeleteNoContent, DeleteNonAuthoritative, Get, GetAccepted, GetNoContent, GetNonAuthoritative, GetPartialContent, GetResetContent, - Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative, + Patch, PatchAccepted, PatchNoContent, PatchNonAuthoritative,C Post, PostAccepted, PostCreated, PostNoContent, PostNonAuthoritative, PostResetContent, Put, PutAccepted, - PutNoContent, PutNonAuthoritative, + PutCreated, PutNoContent, PutNonAuthoritative, ReflectMethod (reflectMethod), StdMethod (..), Verb) import Servant.API.WithNamedContext (WithNamedContext) diff --git a/servant/src/Servant/API/Verbs.hs b/servant/src/Servant/API/Verbs.hs index f6381602..b7d4c048 100644 --- a/servant/src/Servant/API/Verbs.hs +++ b/servant/src/Servant/API/Verbs.hs @@ -56,14 +56,17 @@ type Patch = Verb 'PATCH 200 -- Indicates that a new resource has been created. The URI corresponding to the -- 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'. -- -- Consider using 'Servant.Links.safeLink' for the @Location@ header -- field. -- | 'POST' with 201 status code. --- type PostCreated = Verb 'POST 201 +-- | 'PUT' with 201 status code. +type PutCreated = Verb 'PUT 201 -- ** 202 Accepted