Permalink
Browse files

Bugfix in querystring

  • Loading branch information...
1 parent 5c78c45 commit b9cd3363efc6d249c86ebc2a8e5b523c968aaac9 @ry ry committed Mar 6, 2010
Showing with 5 additions and 1 deletion.
  1. +1 −1 lib/querystring.js
  2. +4 −0 test/simple/test-querystring.js
View
@@ -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);
@@ -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",

0 comments on commit b9cd336

Please sign in to comment.