Support for application/json-patch+json in bodyParser
Author: Edgar0bsjCreated Sep 7, 2025Updated Sep 7, 2025
Hello
Currently, Restify’s bodyParser does not parse requests with
Content-Type: application/json-patch+json (RFC 6902).
When sending a PATCH request, req.body is empty, because bodyParser
only supports application/json.
Workaround: I can manually change the header before parsing, but this is extra boilerplate.
-> Proposal: Add an optional config in bodyParser, like:
server.use(restify.plugins.bodyParser({ jsonPatch: true }));
When jsonPatch is true, Restify should treat
application/json-patch+json as normal JSON.
-> Benefits:
- RFC standard (6902).
- Very small change (just a header check).
- Opt-in (does not break compatibility).
- Improves developer experience for APIs using JSON Patch.
I would like to contribute a PR with this feature. What do you think?
Source: restify/node-restify