Skip to content

Support for auto-generated Accept-Patch header #2878

@Risto-Stevcev

Description

@Risto-Stevcev

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions