2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-17 19:21:29 +03:00

fix(params): removing '[' and ']' from URL encode exclude characters (#3316) (#5715)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
최예찬
2025-08-02 03:44:47 +09:00
committed by GitHub
parent 0dbb7fd4f6
commit 6d84189349
2 changed files with 5 additions and 7 deletions
+1 -3
View File
@@ -16,9 +16,7 @@ function encode(val) {
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']');
replace(/%20/g, '+');
}
/**
+4 -4
View File
@@ -37,7 +37,7 @@ describe('helpers::buildURL', function () {
foo: {
bar: 'baz'
}
})).toEqual('/foo?foo[bar]=baz');
})).toEqual('/foo?foo%5Bbar%5D=baz');
});
it('should support date params', function () {
@@ -48,10 +48,10 @@ describe('helpers::buildURL', function () {
})).toEqual('/foo?date=' + date.toISOString());
});
it('should support array params', function () {
it('should support array params with encode', function () {
expect(buildURL('/foo', {
foo: ['bar', 'baz', null, undefined]
})).toEqual('/foo?foo[]=bar&foo[]=baz');
foo: ['bar', 'baz']
})).toEqual('/foo?foo%5B%5D=bar&foo%5B%5D=baz');
});
it('should support special char params', function () {