-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Incorrect example of using new URL in docs #31301
Comments
NMVikings
added a commit
to NMVikings/node
that referenced
this issue
Jan 10, 2020
2 tasks
MylesBorins
pushed a commit
that referenced
this issue
Jan 16, 2020
PR-URL: #31302 Fixes: #31301 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
codebytere
pushed a commit
that referenced
this issue
Mar 14, 2020
PR-URL: #31302 Fixes: #31301 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
codebytere
pushed a commit
that referenced
this issue
Mar 17, 2020
PR-URL: #31302 Fixes: #31301 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In docs there is incorrect example of code: https://nodejs.org/api/http.html#http_message_url
Here is a quote from the documentation
START OF QUOTE
To parse the URL into its parts:
When
request.url
is'/status?name=ryan'
andrequest.headers.host
is'localhost:3000'
:END OF QUOTE
The first code example is right. To parse request.url from localhost you need to use it:
But in the next code example
new URL('/status?name=ryan', 'localhost:3000')
resolves with URL Object, but it is incorrect behaviour. In real life it throws errorSo the second code example should be:
Code example: https://repl.it/@NMVikings/URL
The text was updated successfully, but these errors were encountered: