Skip to content

Commit acc3a80

Browse files
watildeaddaleax
authored andcommitted
test: add two test cases for querystring
+ Cover untested branch in the state machine with the string that its first letter is `+` in the key/value. + `qs.unescapeBuffer` shouldn't decode `+` to space. PR-URL: #11551 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent e047c99 commit acc3a80

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

test/parallel/test-querystring.js

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const qsTestCases = [
6969
['a&a&a&a&', 'a=&a=&a=&a=', { a: [ '', '', '', '' ] }],
7070
['a=&a=value&a=', 'a=&a=value&a=', { a: [ '', 'value', '' ] }],
7171
['foo+bar=baz+quux', 'foo%20bar=baz%20quux', { 'foo bar': 'baz quux' }],
72+
['+foo=+bar', '%20foo=%20bar', { ' foo': ' bar' }],
7273
[null, '', {}],
7374
[undefined, '', {}]
7475
];
@@ -333,6 +334,7 @@ assert.strictEqual(0xa2, b[18]);
333334
assert.strictEqual(0xe6, b[19]);
334335

335336
assert.strictEqual(qs.unescapeBuffer('a+b', true).toString(), 'a b');
337+
assert.strictEqual(qs.unescapeBuffer('a+b').toString(), 'a+b');
336338
assert.strictEqual(qs.unescapeBuffer('a%').toString(), 'a%');
337339
assert.strictEqual(qs.unescapeBuffer('a%2').toString(), 'a%2');
338340
assert.strictEqual(qs.unescapeBuffer('a%20').toString(), 'a ');

0 commit comments

Comments
 (0)