Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url: export URLSearchParams #10801

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,7 @@ function urlToOptions(url) {
}

exports.URL = URL;
exports.URLSearchParams = URLSearchParams;
exports.originFor = originFor;
exports.domainToASCII = domainToASCII;
exports.domainToUnicode = domainToUnicode;
Expand Down
1 change: 1 addition & 0 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exports.resolve = urlResolve;
exports.resolveObject = urlResolveObject;
exports.format = urlFormat;
exports.URL = internalUrl.URL;
exports.URLSearchParams = internalUrl.URLSearchParams;
exports.originFor = internalUrl.originFor;
exports.domainToASCII = internalUrl.domainToASCII;
exports.domainToUnicode = internalUrl.domainToUnicode;
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-append.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Append same name
params = new URLSearchParams();
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Basic URLSearchParams construction
params = new URLSearchParams();
Expand Down
10 changes: 4 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const url = require('url');
const URL = url.URL;
const URLSearchParams = url.URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Delete basics
params = new URLSearchParams('a=b&c=d');
Expand Down
12 changes: 4 additions & 8 deletions test/parallel/test-whatwg-url-searchparams-foreach.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,14 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
const url = require('url');
const URL = url.URL;
const URLSearchParams = url.URLSearchParams;

let a, b, i;

// ForEach Check
params = new URLSearchParams('a=1&b=2&c=3');
const params = new URLSearchParams('a=1&b=2&c=3');
const keys = [];
const values = [];
params.forEach(function(value, key) {
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Get basics
params = new URLSearchParams('a=b&c=d');
Expand Down
9 changes: 2 additions & 7 deletions test/parallel/test-whatwg-url-searchparams-getall.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
const URLSearchParams = require('url').URLSearchParams;

let params;
let matches;

// getAll() basics
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-has.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Has basics
params = new URLSearchParams('a=b&c=d');
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Set basics
params = new URLSearchParams('a=b&c=d');
Expand Down
8 changes: 2 additions & 6 deletions test/parallel/test-whatwg-url-searchparams-stringifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@

require('../common');
const assert = require('assert');
const URL = require('url').URL;
const URLSearchParams = require('url').URLSearchParams;

const m = new URL('http://example.org');
let params = m.searchParams;

// Until we export URLSearchParams
const URLSearchParams = params.constructor;
let params;

// Serialize space
// querystring does not currently handle spaces intelligently
Expand Down