From 9962d31e69a254ba23e70adcc656873ff6381a2c Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Tue, 21 Feb 2017 17:07:03 -0600 Subject: [PATCH 1/3] Update common-node.js i was just reading the source and noticed this, if there is some reason it won't work please let me know --- lib/common-node.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/common-node.js b/lib/common-node.js index 55ef8eb..8c18f1c 100644 --- a/lib/common-node.js +++ b/lib/common-node.js @@ -66,13 +66,10 @@ exports.querystringParse = function (q) { * @return {string} */ exports.querystringStringify = function (obj) { - var saved = querystring.escape - querystring.escape = escape // global - var ret = querystring.stringify(obj) + var ret = querystring.stringify(obj, { encodeURIComponent: escape }) ret = ret.replace(/[@*/+]/g, function (char) { // `escape` doesn't encode the characters @*/+ so we do it manually return '%' + char.charCodeAt(0).toString(16).toUpperCase() }) - querystring.escape = saved return ret } From e771c0f57ed4414d7721c4dcf649768b9eaadfd2 Mon Sep 17 00:00:00 2001 From: Gus Caplan Date: Tue, 21 Feb 2017 17:16:18 -0600 Subject: [PATCH 2/3] Update common-node.js --- lib/common-node.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/common-node.js b/lib/common-node.js index 8c18f1c..5d9f2e5 100644 --- a/lib/common-node.js +++ b/lib/common-node.js @@ -52,11 +52,7 @@ exports.toUInt32 = toUInt32 * @return {Object} */ exports.querystringParse = function (q) { - var saved = querystring.unescape - querystring.unescape = unescape // global - var ret = querystring.parse(q) - querystring.unescape = saved - return ret + return querystring.parse(q, { decodeURIComponent: unescape }) } /** From 714400abae4ef2adf95cf970317ca3b8c670fcb1 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 8 Mar 2017 02:07:48 -0800 Subject: [PATCH 3/3] use correct API signature in querystring methods --- lib/common-node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/common-node.js b/lib/common-node.js index 5d9f2e5..b06d000 100644 --- a/lib/common-node.js +++ b/lib/common-node.js @@ -52,7 +52,7 @@ exports.toUInt32 = toUInt32 * @return {Object} */ exports.querystringParse = function (q) { - return querystring.parse(q, { decodeURIComponent: unescape }) + return querystring.parse(q, null, null, { decodeURIComponent: unescape }) } /** @@ -62,7 +62,7 @@ exports.querystringParse = function (q) { * @return {string} */ exports.querystringStringify = function (obj) { - var ret = querystring.stringify(obj, { encodeURIComponent: escape }) + var ret = querystring.stringify(obj, null, null, { encodeURIComponent: escape }) ret = ret.replace(/[@*/+]/g, function (char) { // `escape` doesn't encode the characters @*/+ so we do it manually return '%' + char.charCodeAt(0).toString(16).toUpperCase()