-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http: document that ClientRequest inherits from OutgoingMessage #42642
Conversation
Review requested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you suggesting this change? The previous examples looked correct to me.
The previous examples used |
Lines 107 to 124 in 2468db1
getHeaders() in IncomingMessage .
|
Please see the below code snippet: var http = require('http');
var options = {
'method': 'GET',
'hostname': 'www.example.com',
'path': '/',
'headers': {
'test': 'abcd'
},
'maxRedirects': 20
};
var req = http.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
// console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
console.log(req.getHeaders());
req.end(); If you use |
That's not an Lines 112 to 113 in 646e057
getHeaders() clearly documented there.
There is one mistake in the doc now that I see it: it states that |
ok, so in that case the current pull-request is good I assume. Can you please approve. |
As I said above, it's not correct. |
Hey @kcak11 thank you for your contribution to Node.js. As Matteo explained this change (headers -> getHeaders) isn't correct (I know this whole ClientRequest/IncomingMessage stuff might be confusing in the docs). There are many other places you can contribute in the docs though - lots of APIs/events would benefit from examples and more explanations about what they do. |
Ok, I just fixed the extends for http.ClientRequest to point to http.OutgoingMessage If thats ok for this PR to get merged, then it is fine. Otherwise I can close this PR and come back later. |
Fixed the error: f636bf8 |
change is good! Can you squash the commits and update the PR title? Thanks! |
I think I don't have permission to squash the commits. While merging the PR I guess it gives the option to Squash. Right now the Merge option is disabled for me. |
@kcak11 you can squash the commits by going to your local checkout and running |
You accidentally merged instead of rebasing that (there are now 8 commits instead of 1). To float your head on top of the squashed commit 7cc9ddf you can: # in your branch, reset to master
$ git reset --hard origin/master
# take just the commit
$ git cheery-pick 7cc9ddf68e89dc3627d6e826de091dc76483c200
# push, overriding the status but only if no one else did
# assumes your remote is called "mine" but change to whatever you're using :)
$ git push --force-with-lease mine HEAD |
Ran the same commands and it resulted in 5dde7af Now I see 9 commits in the PR |
That implies that you either didn't This is further implied by your branch name (also master) :] You need to reset to Node's master branch and base your changes on top of that - this probably means the first step $ git remote add node https://github.com/nodejs/node/
$ git fetch node master
$ git reset --hard node/master |
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file
Thanks, it worked this time. Now there is a single commit with all the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@mcollina / @benjamingr / @ShogunPanda / @VoltrexMaster can one of you please merge the PR as all the checks have passed. Thanks in advance. |
Pull requests must wait at least 2 days before landing as stated here unless fast-tracked using the
fast-track
Which this PR can fast-tracked, if agreed by other collaborators. |
Fast-track has been requested by @benjamingr. Please 👍 to approve. |
Landed in 28d8614 |
Congrats on your first commit @kcak11 🎉 |
Thanks @benjamingr |
Since I am a new contributor to this repo, just curious to know if I need to do anything else for the document to get updated. Right now I don't see the changes in this PR being reflected in the doc although there was a 17.9.0 release today. Does the doc publish & update take more time ? |
@kcak11 can take time, I assume the change is not in that version yet (though you can check the tag yourself and see) - non urgent (read: non security) changes aren't treated urgently :) If you'd like: there is a lot of improvement potential in the docs:
I also think @Trott who has been doing a lot of good docs work may have better intuition than I do about it :) |
Thanks for the information @benjamingr |
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: nodejs#42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: #42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: #42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: #42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: #42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
http: fix extends for ClientRequest from Stream to http.OutgoingMessage http: added page entry for http.OutgoingMessage http: updated order of links http: included entry for http.OutgoingMessage http: removed unnecessary entry from md file PR-URL: nodejs/node#42642 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
No description provided.