-
-
Notifications
You must be signed in to change notification settings - Fork 21.8k
Open
Description
The auto-generated OPTIONS response works well, but it there currently isn't any option that you can set to include Accept-Patch for the media type(s) that your API's PATCH request accepts.
Creating a middleware function like this doesn't work because the middleware executes before the auto-generated OPTIONS response:
let acceptPatch = function(req, res, next) {
if (/PATCH/.test(req.get('Allow')))
res.set('Accept-Patch', 'application/json')
next()
}
router.use(acceptPatch) // won't work because req.get('Allow') hasn't been auto-generated yet