diff --git a/lib/common-node.js b/lib/common-node.js index 55ef8eb..b06d000 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, null, null, { decodeURIComponent: unescape }) } /** @@ -66,13 +62,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, 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() }) - querystring.escape = saved return ret }