-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
querystring: Parse multiple separator characters
Fix querystring.parse to handle multiple separator characters PR-URL: #3807 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
- Loading branch information
1 parent
483a41c
commit a776a86
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const qs = require('querystring'); | ||
|
||
assert.deepEqual( | ||
qs.parse('foo=>bar&&bar=>baz', '&&', '=>'), | ||
{foo: 'bar', bar: 'baz'} | ||
); | ||
|
||
assert.strictEqual( | ||
qs.stringify({foo: 'bar', bar: 'baz'}, '&&', '=>'), | ||
'foo=>bar&&bar=>baz' | ||
); | ||
|
||
assert.deepEqual( | ||
qs.parse('foo==>bar, bar==>baz', ', ', '==>'), | ||
{foo: 'bar', bar: 'baz'} | ||
); | ||
|
||
assert.strictEqual( | ||
qs.stringify({foo: 'bar', bar: 'baz'}, ', ', '==>'), | ||
'foo==>bar, bar==>baz' | ||
); |