diff --git a/src/index.js b/src/index.js index 8941423..2c0368b 100644 --- a/src/index.js +++ b/src/index.js @@ -226,7 +226,7 @@ export function parseQueryString(queryString: string): Object { query = query.substr(1); } - let pairs = query.replace(/\+/g, ' ').split('&'); + let pairs = query.split('&'); for (let i = 0; i < pairs.length; i++) { let pair = pairs[i].split('='); let key = decodeURIComponent(pair[0]); diff --git a/test/path.spec.js b/test/path.spec.js index e3fdbe1..46201b0 100644 --- a/test/path.spec.js +++ b/test/path.spec.js @@ -272,5 +272,7 @@ describe('query strings', () => { expect(parse('a[b][c][d]=e')).toEqual({a: {b: {c: {d: 'e'}}}}); expect(parse('a[b][]=c&a[b][]=d&a[b][2][]=f&a[b][2][]=g')).toEqual({a: {b: ['c','d', ['f', 'g']]}}); expect(parse('a[0]=b')).toEqual({a: ['b']}); + + expect(parse('a=b+c')).toEqual({a: 'b+c'}); }); });