restify / restify/node-restify
`res.send` should be not auto-coerce to application/json
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.7k
- Forks
- 975
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 5
Description
- Used appropriate template for the issue type
- Searched both open and closed issues for duplicates of this issue
- Title adequately and concisely reflects the feature or the bug
Bug Report
When res.send is called, and a content-type is not explicitly set, application/json is chosen as the default content type if the first parameter received by send is a JS object. This behavior can be confusing (even more so when strictFormatters; false), and seems to be unnecessary given that res.json exists to do the same thing.
Something worth considering as we figure out how to decouple content negotiation from formatters moving forward.
cc @misterdjules
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 in lib/response.js around the res.send implementation linked in the issue, and read how the default content type is selected for JavaScript objects, including the strictFormatters setting. Clarify the intended behavior with the existing res.json path and content-negotiation logic; done means res.send no longer implicitly selects application/json for an object when no content type is set.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100