From 59f95fe4dc0f8f270a611a16963e91f10c32b742 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 24 Jan 2022 18:04:22 -0800 Subject: [PATCH] doc: clarify treatment of non-string argument to new URL() Closes: https://github.com/nodejs/node/issues/41653 PR-URL: https://github.com/nodejs/node/pull/41658 Fixes: https://github.com/nodejs/node/issues/41653 Reviewed-By: Richard Lau Reviewed-By: Mohammed Keyvanzadeh Reviewed-By: Luigi Pinca Reviewed-By: Darshan Sen Reviewed-By: Mestery Reviewed-By: Benjamin Gruenbaum --- doc/api/url.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/api/url.md b/doc/api/url.md index 16a00ae469e0fa..e5865a5d313d1e 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -131,7 +131,7 @@ return `true`. * `input` {string} The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` - is ignored. + is ignored. If `input` is not a string, it is [converted to a string][] first. * `base` {string|URL} The base URL to resolve against if the `input` is not absolute. @@ -1684,6 +1684,7 @@ console.log(myURL.origin); [`url.toString()`]: #urltostring [`urlSearchParams.entries()`]: #urlsearchparamsentries [`urlSearchParams@@iterator()`]: #urlsearchparamssymboliterator +[converted to a string]: https://tc39.es/ecma262/#sec-tostring [examples of parsed URLs]: https://url.spec.whatwg.org/#example-url-parsing [host name spoofing]: https://hackerone.com/reports/678487 [legacy `urlObject`]: #legacy-urlobject