doc: res.getHeaders return value wrong in docsΒ #12885
Copy link
Copy link
Closed
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
Description
- Version: 7
- Platform: *
- Subsystem: HTTP
Ref: https://github.com/nodejs/node/pull/12883/files#r115149721
const headersCopy = res.getHeaders();
assert.ok(headersCopy instanceof Object);Fails with AssertionError [ERR_ASSERTION]: false == true
In contradiction to API https://nodejs.org/api/http.html#http_response_getheaders
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.httpIssues and PRs related to the http subsystem.Issues and PRs related to the http subsystem.
Activity
refack commentedon May 7, 2017
More concretely
headersCopy.hasOwnProperty === undefined&
headersCopy.propertyIsEnumerable === undefinedaddaleax commentedon May 7, 2017
See #12883 (comment) β can please you be precise about what the issue is or what you want to do here? Otherwise this issue is just stating facts.
refack commentedon May 7, 2017
If there is a reason why it has a
nullprototype, we need to correct the API documentation.Else just give it a prototype.
addaleax commentedon May 7, 2017
Yes, because header names can clash with the built-in fields of Object.prototype (for example with
__proto__itself).Are you talking about docs?
refack commentedon May 7, 2017
Yes
mscdex commentedon May 7, 2017
You can probably just copy the text from
querystring.parse().[-]http: res.getHeaders return value not an Object[/-][+]doc: res.getHeaders return value wrong in docs[/+]doc, test: add note to response.getHeaders
refack commentedon May 10, 2017
Fixed by: #12887
doc, test: add note to response.getHeaders