Skip to content

Commit

Permalink
fix: Return 201 when PATCH creates a new resource
Browse files Browse the repository at this point in the history
A PATCH request may end up creating a new resource, in which case a 201 status code should be returned.
  • Loading branch information
CxRes authored May 31, 2024
1 parent f589a20 commit d7b7bd9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/handlers/patch.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ async function patchHandler (req, res, next) {
})

// Send the result to the client
res.sendStatus(resourceExists ? 200 : 201)
res.send(result)
} catch (err) {
return next(err)
Expand Down

0 comments on commit d7b7bd9

Please sign in to comment.