Skip to content
Closed
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
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.
  • Loading branch information
watilde committed Feb 25, 2017
commit c978769e4b9ed90717d625edba49685f87b0496b
2 changes: 2 additions & 0 deletions test/parallel/test-querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ const qsTestCases = [
['a&a&a&a&', 'a=&a=&a=&a=', { a: [ '', '', '', '' ] }],
['a=&a=value&a=', 'a=&a=value&a=', { a: [ '', 'value', '' ] }],
['foo+bar=baz+quux', 'foo%20bar=baz%20quux', { 'foo bar': 'baz quux' }],
['+foo=+bar', '%20foo=%20bar', { ' foo': ' bar' }],
[null, '', {}],
[undefined, '', {}]
];
Expand Down Expand Up @@ -333,6 +334,7 @@ assert.strictEqual(0xa2, b[18]);
assert.strictEqual(0xe6, b[19]);

assert.strictEqual(qs.unescapeBuffer('a+b', true).toString(), 'a b');
assert.strictEqual(qs.unescapeBuffer('a+b').toString(), 'a+b');
assert.strictEqual(qs.unescapeBuffer('a%').toString(), 'a%');
assert.strictEqual(qs.unescapeBuffer('a%2').toString(), 'a%2');
assert.strictEqual(qs.unescapeBuffer('a%20').toString(), 'a ');
Expand Down