Skip to content

Commit

Permalink
Fixing special char encoding (axios#1671)
Browse files Browse the repository at this point in the history
* removing @ character from replacement list since it is a reserved character

* Updating buildURL test to not include the @ character

* Removing console logs

Co-authored-by: Jay <jasonsaayman@gmail.com>
  • Loading branch information
cygnusss and jasonsaayman authored May 27, 2020
1 parent 988957e commit 8e9490b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion lib/helpers/buildURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ var utils = require('./../utils');

function encode(val) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
Expand Down
4 changes: 2 additions & 2 deletions test/specs/helpers/buildURL.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ describe('helpers::buildURL', function () {

it('should support special char params', function () {
expect(buildURL('/foo', {
foo: '@:$, '
})).toEqual('/foo?foo=@:$,+');
foo: ':$, '
})).toEqual('/foo?foo=:$,+');
});

it('should support existing params', function () {
Expand Down

0 comments on commit 8e9490b

Please sign in to comment.