fixed request accept jsdoc
Description
This pull request updates the JSDoc for req.accepts() to correct two inaccuracies in the current documentation. These updates align the JSDoc with the behavior of the underlying npm package used by Express for content negotiation.
What This PR Fixes
-
Incorrect return value
The existing JSDoc states that the method returnsundefinedwhen no acceptable type is found.
In reality, the underlying negotiation package returnsfalse, and that is what Express exposes.Supporting code (from the underlying
acceptspackage):// returns the best match or false return type || false -
Comma-separated values are not supported
Some examples suggested that a comma-separated string (e.g., "json, text") is treated as multiple types. The npm package does not parse comma-separated strings. Only arrays or multiple arguments are supported.Supporting code (from the same package):
if (!Array.isArray(types)) { types = new Array(arguments.length); for (var i = 0; i < types.length; i++) { types[i] = arguments[i]; } }
This shows that each argument is captured individually, and values are not split on commas.
Why This Matters
The old JSDoc can mislead developers when debugging Accept header behavior or relying on inline IntelliSense. This PR corrects the documentation so it accurately reflects the behavior of the npm module Express depends on.
Disclaimer
The incorrect assumptions present in the old JSDoc also exist in the underlying npm package. This PR updates only the Express documentation and does not modify or fix the dependency itself.