querystring: remove `name` from `stringify()`
authorYorkie <l900422@vip.qq.com>
Sat, 28 Dec 2013 12:59:57 +0000 (20:59 +0800)
committerTrevor Norris <trev.norris@gmail.com>
Mon, 30 Dec 2013 19:41:37 +0000 (11:41 -0800)
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>
lib/querystring.js
test/simple/test-querystring.js

index e9ff825..436789e 100644 (file)
@@ -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.
index 483982c..04d085b 100644 (file)
@@ -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