Skip to content

Commit d7b7bd9

Browse files
authored
fix: Return 201 when PATCH creates a new resource
A PATCH request may end up creating a new resource, in which case a 201 status code should be returned.
1 parent f589a20 commit d7b7bd9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/handlers/patch.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ async function patchHandler (req, res, next) {
9292
})
9393

9494
// Send the result to the client
95+
res.sendStatus(resourceExists ? 200 : 201)
9596
res.send(result)
9697
} catch (err) {
9798
return next(err)

0 commit comments

Comments
 (0)