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",