Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exports.parse = function(str){
try{
pair = decodeURIComponent(pair.replace(/\+/g, ' '));
} catch(e) {
// ignore
pair = unescape(pair.replace(/\+/g, ' '));
}

var eql = pair.indexOf('=')
Expand Down
7 changes: 6 additions & 1 deletion test/parse.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ module.exports = {
'test malformed uri': function(){
qs.parse('{%:%}').should.eql({ '{%:%}': '' });
qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' });
qs.parse('foo=%:%}%20').should.eql({ 'foo': '%:%} ' });
},

'test unescaping of non-utf8 encoded data': function(){
qs.parse('foo=%E4%20bar').should.eql({ 'foo': String.fromCharCode('228') + ' bar' });
}

// 'test complex': function(){
// qs.parse('users[][name][first]=tj&users[foo]=bar')
// .should.eql({
Expand Down