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

test: add two test cases for querystring #11481

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/parallel/test-querystring.js
Expand Up @@ -288,6 +288,11 @@ assert.strictEqual(
Object.keys(qs.parse('a=1&b=1&c=1', null, null, { maxKeys: 1 })).length,
1);

// Test limiting with a case that starts from `&`
assert.strictEqual(
Object.keys(qs.parse('&a', null, null, { maxKeys: 1 })).length,
0);

// Test removing limit
function testUnlimitedKeys() {
const query = {};
Expand Down Expand Up @@ -334,6 +339,8 @@ assert.strictEqual(qs.unescapeBuffer('a%20').toString(), 'a ');
assert.strictEqual(qs.unescapeBuffer('a%2g').toString(), 'a%2g');
assert.strictEqual(qs.unescapeBuffer('a%%').toString(), 'a%%');

// Test invalid encoded string
check(qs.parse('%\u0100=%\u0101'), { '%Ā': '%ā' });

// Test custom decode
function demoDecode(str) {
Expand Down