Merge pull request #209 from GusCaplan/patch-1

Update common-node.js
This commit is contained in:
Feross Aboukhadijeh 2017-03-08 02:12:07 -08:00 committed by GitHub
commit 173161cc47

View File

@ -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
}