Permalink
Browse files

Fixed + as a space

  • Loading branch information...
1 parent 2b9796e commit 0b40ca5f0bf439a1bf3032eb172f8a0f828c84ba @tj committed Feb 9, 2011
Showing with 4 additions and 1 deletion.
  1. +1 −1 lib/querystring.js
  2. +3 −0 test/querystring.test.js
View
@@ -23,7 +23,7 @@ exports.parse = function(str) {
return String(str)
.split('&')
.reduce(function(ret, pair){
- var pair = decodeURIComponent(pair)
+ var pair = decodeURIComponent(pair).replace(/\+/g, ' ')
, eql = pair.indexOf('=')
, brace = lastBraceInKey(pair)
, key = pair.substr(0, brace || eql)
View
@@ -8,6 +8,9 @@ var qs = require('../')
module.exports = {
'test basics': function(){
+ qs.parse('foo=c++')
+ .should.eql({ foo: 'c ' });
+
qs.parse('a[>=]=23')
.should.eql({ a: { '>=': '23' }});

0 comments on commit 0b40ca5

Please sign in to comment.