-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
url: handle URL.canParse without base parameter
PR-URL: #47547 Backport-PR-URL: #48345 Reviewed-By: Debadree Chatterjee <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Robert Nagy <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
- Loading branch information
1 parent
0dc485e
commit 8897305
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
|
||
require('../common'); | ||
|
||
const { URL } = require('url'); | ||
const assert = require('assert'); | ||
|
||
let internalBinding; | ||
try { | ||
internalBinding = require('internal/test/binding').internalBinding; | ||
} catch (e) { | ||
console.log('using `test/parallel/test-whatwg-url-canparse` requires `--expose-internals`'); | ||
throw e; | ||
} | ||
|
||
const { canParse } = internalBinding('url'); | ||
|
||
// It should not throw when called without a base string | ||
assert.strictEqual(URL.canParse('https://example.org'), true); | ||
assert.strictEqual(canParse('https://example.org'), true); |