We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ede69d2 commit 4839fc4Copy full SHA for 4839fc4
lib/internal/url.js
@@ -978,6 +978,10 @@ class URL {
978
}
979
980
static canParse(url, base = undefined) {
981
+ if (arguments.length === 0) {
982
+ throw new ERR_MISSING_ARGS('url');
983
+ }
984
+
985
url = `${url}`;
986
987
if (base !== undefined) {
test/parallel/test-url-canParse-whatwg.js
@@ -0,0 +1,12 @@
1
+'use strict';
2
3
+require('../common');
4
+const assert = require('assert');
5
6
+// One argument is required
7
+assert.throws(() => {
8
+ URL.canParse();
9
+}, {
10
+ code: 'ERR_MISSING_ARGS',
11
+ name: 'TypeError'
12
+});
0 commit comments