From b9cd3363efc6d249c86ebc2a8e5b523c968aaac9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 5 Mar 2010 17:07:02 -0800 Subject: [PATCH] Bugfix in querystring --- lib/querystring.js | 2 +- test/simple/test-querystring.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/querystring.js b/lib/querystring.js index d258fc297d..ef50cafa45 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -68,7 +68,7 @@ QueryString.stringify = function (obj, sep, eq, name) { }; QueryString.parseQuery = QueryString.parse = function (qs, sep, eq) { - return qs + return (qs || '') .split(sep||"&") .map(pieceParser(eq||"=")) .reduce(mergeParams); diff --git a/test/simple/test-querystring.js b/test/simple/test-querystring.js index 58a70fe0c4..9295ff7e12 100644 --- a/test/simple/test-querystring.js +++ b/test/simple/test-querystring.js @@ -114,6 +114,10 @@ var f = qs.stringify({ }); assert.equal(f, "a=b&q=x%3Dy%26y%3Dz"); +assert.doesNotThrow(function () { + qs.parse(undefined); +}); + // nested in colon var f = qs.stringify({ a : "b",