Skip to content

Commit 32478b3

Browse files
committed
Merge pull request #599 from mhils/fix-withQuery
[fixed] Path.withQuery strips query if query is empty
2 parents cb77bf2 + 0862ea2 commit 32478b3

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

modules/utils/Path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ var Path = {
149149
if (queryString)
150150
return Path.withoutQuery(path) + '?' + queryString;
151151

152-
return path;
152+
return Path.withoutQuery(path);
153153
},
154154

155155
/**

modules/utils/__tests__/Path-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ describe('Path.withQuery', function () {
321321
expect(Path.withQuery('/a/b/c', { id: 'def' })).toEqual('/a/b/c?id=def');
322322
});
323323

324+
it('removes query string', function () {
325+
expect(Path.withQuery('/a/b/c?a=b', { a: undefined })).toEqual('/a/b/c');
326+
});
327+
324328
it('merges two query strings', function () {
325329
expect(Path.withQuery('/path?a=b', { c: [ 'd', 'e' ]})).toEqual('/path?a=b&c%5B0%5D=d&c%5B1%5D=e');
326330
});

0 commit comments

Comments
 (0)