Skip to content

Commit fe5ec39

Browse files
committed
[fixed] Double-encoding of query strings
Also, don't use indices in array query string values. Fixes #721
1 parent cc5490e commit fe5ec39

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

modules/utils/Path.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ var Path = {
144144
if (existingQuery)
145145
query = query ? merge(existingQuery, query) : existingQuery;
146146

147-
var queryString = query && qs.stringify(query);
147+
var queryString = qs.stringify(query, { indices: false });
148148

149149
if (queryString)
150-
return Path.withoutQuery(path) + '?' + queryString;
150+
return Path.withoutQuery(path) + '?' + decodeURIComponent(queryString);
151151

152152
return path;
153153
},

modules/utils/__tests__/Path-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ describe('Path.withQuery', function () {
322322
});
323323

324324
it('merges two query strings', function () {
325-
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ]})).toEqual('/path?a=b&c%5B0%5D=d&c%5B1%5D=e');
325+
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ] })).toEqual('/path?a=b&c=d&c=e');
326326
});
327327
});
328328

0 commit comments

Comments
 (0)