-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.
Description
- Version: master
- Platform: n/a
- Subsystem: doc
The documentation for request.path mentions that the property is read-only, which is misleading.
First, it is technically not set as a real read-only property, so it is mutable. Secondly, request.path is read from at a later point in time if headers was not passed to the ClientRequest constructor.
Here is a small example that shows this:
const http = require('http');
http.createServer(function(req, res) {
this.close();
console.log('req.url =', req.url);
res.end();
}).listen(0, function() {
const req = http.request(
{ port: this.address().port, method: 'GET' },
(res) => res.resume()
);
console.log('req.path =', req.path);
req.path = '/foo/bar/baz';
req.end();
});
// prints:
// req.path = /
// req.url = /foo/bar/bazI would suggest removing the 'Read-only' portion from the description or making the property truly read-only using the appropriate property descriptor.
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to the documentations.Issues and PRs related to the documentations.httpIssues or PRs related to the http subsystem.Issues or PRs related to the http subsystem.