Browse Source

querystring: remove `name` from `stringify()`

QueryString.stringify() allowed a fourth argument that was used as a
conditional in the return value, but was undocumented, not used by core
and always was always false/undefiend. So the argument and conditional
have been removed.

Signed-off-by: Trevor Norris <trev.norris@gmail.com>
v0.11.10-release
Yorkie 11 years ago
committed by Trevor Norris
parent
commit
8d3bc88bbe
  1. 7
      lib/querystring.js
  2. 2
      test/simple/test-querystring.js

7
lib/querystring.js

@ -125,7 +125,7 @@ var stringifyPrimitive = function(v) {
};
QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) {
QueryString.stringify = QueryString.encode = function(obj, sep, eq) {
sep = sep || '&';
eq = eq || '=';
if (util.isNull(obj)) {
@ -145,10 +145,7 @@ QueryString.stringify = QueryString.encode = function(obj, sep, eq, name) {
}).join(sep);
}
if (!name) return '';
return QueryString.escape(stringifyPrimitive(name)) + eq +
QueryString.escape(stringifyPrimitive(obj));
return '';
};
// Parse a key=val string.

2
test/simple/test-querystring.js

@ -124,7 +124,7 @@ qsWeirdObjects.forEach(function(testCase) {
});
qsNoMungeTestCases.forEach(function(testCase) {
assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '=', false));
assert.deepEqual(testCase[0], qs.stringify(testCase[1], '&', '='));
});
// test the nested qs-in-qs case

Loading…
Cancel
Save