Support for auto-generated Accept-Patch header
Open
discuss
investigate
module:router
- Dominant language
- JavaScript
- Stars
- 69.5k
- Forks
- 25k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
The auto-generated `OPTIONS` response works well, but it there currently isn't any option that you can set to include [Accept-Patch](http://tools.ietf.org/html/rfc5789#section-3.1) 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:
``` javascript
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
```
Contributor guide
Assessment
This issue has not been assessed yet.