Skip to content

Commit d59277a

Browse files
committed
url: handle URL.canParse without base parameter
1 parent c856ec5 commit d59277a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/node_url.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void BindingData::DomainToUnicode(const FunctionCallbackInfo<Value>& args) {
115115

116116
// TODO(@anonrig): Add V8 Fast API for CanParse method
117117
void BindingData::CanParse(const FunctionCallbackInfo<Value>& args) {
118-
CHECK_GE(args.Length(), 2);
118+
CHECK_GE(args.Length(), 1);
119119
CHECK(args[0]->IsString()); // input
120120
// args[1] // base url
121121

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
require('../common');
4+
5+
const { URL } = require('url');
6+
const assert = require('assert');
7+
8+
// It should not throw when called without a base string
9+
assert.strictEqual(URL.canParse('https://example.org'), true);

0 commit comments

Comments
 (0)