restify / restify/node-restify
Support for application/json-patch+json in bodyParser
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 975
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the bodyParser plugin entry point and trace its Content-Type handling. Implement the opt-in jsonPatch behavior described in the issue, then verify that a PATCH request with application/json-patch+json populates req.body while default behavior remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100