1
0
Fork 0

Stricter RFC 3986 compliance for querystrings.

This commit is contained in:
Alan Plum 2015-01-14 15:23:28 +01:00
parent 15435982f6
commit 576f4f4064
1 changed files with 5 additions and 1 deletions

View File

@ -100,7 +100,11 @@ function querystringify(query, useQuerystring) {
if (typeof query === 'string') {
return query.charAt(0) === '?' ? query.slice(1) : query;
}
return (useQuerystring ? querystring : qs).stringify(query);
return (useQuerystring ? querystring : qs).stringify(query)
.replace(/[!'()*]/g, function(c) {
// Stricter RFC 3986 compliance
return '%' + c.charCodeAt(0).toString(16);
});
}
function request(req) {