-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Get method does not check options's Object prototype #12092
Comments
The issue is that, under the hood, |
Last time this was discussed it led to nowhere: nodejs/node-v0.x-archive#7587 (FWIW, my opinion on it hasn't changed) But I agree it should at least be documented. |
@seishun I agree on the documentation bit. |
I think this issue is just a mod of this one here: nodejs/node-v0.x-archive#7587 (comment) |
Thank you for the quick response! Regarding the second question. If _extend is used then a shallow copy is made. Any alteration to the properties not on the first level will impact the first request if the object is used after a asynchronous call. Is this the case? |
Added |
Extra notes that options doesn't include the prototype when copied Fixes: nodejs#12092 PR-URL: nodejs#12124 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
The get method of http and https modules does not check the prototype of the given object. I guess this replicates to all other request/response methods.
The following code is ran on a machine that does not have anything running on port 8989:
And we receive the following output:
This means the port takes the default value and successfully connects instead of taking the 8989 port from the prototype.
The need for this code arose from the necessity to reuse some default options in multiple requests. So I would like to ask a followup question:
The text was updated successfully, but these errors were encountered: