summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-02-08 03:23:03 -0500
committerJames M Snell <jasnell@gmail.com>2017-02-13 10:40:37 -0800
commitff785fd51792a95281014b5e9b526c6619450dc9 (patch)
tree8098e9b1c65e4bd6f7d711f38458b8036cb27996 /test
parentd3be0f88181b4904f5ceddb88043ef589d777c45 (diff)
downloadandroid-node-v8-ff785fd51792a95281014b5e9b526c6619450dc9.tar.gz
android-node-v8-ff785fd51792a95281014b5e9b526c6619450dc9.tar.bz2
android-node-v8-ff785fd51792a95281014b5e9b526c6619450dc9.zip
querystring: fix empty pairs and optimize parse()
This commit fixes handling of empty pairs that occur before the end of the query string so that they are also ignored. Additionally, some optimizations have been made, including: * Avoid unnecessary code execution where possible * Use a lookup table when checking for hex characters * Avoid forced decoding when '+' characters are encountered and we are using the default decoder Fixes: https://github.com/nodejs/node/issues/10454 PR-URL: https://github.com/nodejs/node/pull/11234 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Nicu Micleușanu <micnic90@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-querystring.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/parallel/test-querystring.js b/test/parallel/test-querystring.js
index baa426094c..04034377fe 100644
--- a/test/parallel/test-querystring.js
+++ b/test/parallel/test-querystring.js
@@ -59,6 +59,15 @@ const qsTestCases = [
['&&&&', '', {}],
['&=&', '=', { '': '' }],
['&=&=', '=&=', { '': [ '', '' ]}],
+ ['a&&b', 'a=&b=', { 'a': '', 'b': '' }],
+ ['a=a&&b=b', 'a=a&b=b', { 'a': 'a', 'b': 'b' }],
+ ['&a', 'a=', { 'a': '' }],
+ ['&=', '=', { '': '' }],
+ ['a&a&', 'a=&a=', { a: [ '', '' ] }],
+ ['a&a&a&', 'a=&a=&a=', { a: [ '', '', '' ] }],
+ ['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' }],
[null, '', {}],
[undefined, '', {}]
];