Repository navigation
Documentation for http.message.url suggests using deprecated url API #30048
Description
Activity
The WHATWG URL API will not work in this case unless a bogus base URL is provided as second argument.
- addeddocIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.
on Oct 21, 2019 @lpinca Can I work on this issue?
This is my first time contributing to Node.jsYes but again, there is no equivalent for WHATWG URL.
Reacted by Tadao IsekiHmm… Should I remove deprecated docs or update with WHATWG URL to provide a bogus URL as second argument?
If the later, I will replace it like this:
> new URL('/status?name=ryan', 'https://nodejs.org') URL { href: 'https://nodejs.org/status?name=ryan', origin: 'https://nodejs.org', protocol: 'https:', username: '', password: '', host: 'nodejs.org', hostname: 'nodejs.org', port: '', pathname: '/status', search: '?name=ryan', searchParams: URLSearchParams { 'name' => 'ryan' }, hash: '' }
@nodejs/url
@lpinca i would like to work on this issue.
In the context of
http.IncomingMessage, it might make sense to suggest something likenew URL(request.url, `http://${request.headers.host}`);(or
http://can be replaced with a${protocol}://to be more generic. Of course this does not work ifrequest.headersdoes not actually containhostbut I guess in that case a 404 should already be sent anyway)Then give some examples like the one in #30048 (comment)
Reacted by Tadao Iseki@joyeecheung Thank you for a good idea! I will try to refactor doc soon.
- added 2 commits that reference this issue
on Dec 7, 2019 - added a commit that references this issue
on Dec 18, 2019 - added a commit that references this issue
on Jan 3, 2020 - added a commit that references this issue
on Jan 14, 2020 - added a commit that references this issue
on Feb 6, 2020
At the following piece of documentation (for v12; the latest one):
It describes:
However, this legacy
urlmodule/API is deprecated since v11.Thus, the documentation should be updated.
Bonus points for grepping the rest of the documentation to find other outdated examples.