If paramsSerializer is not specified, brackets are not encoded
See original GitHub issueDescribe the issue
The default behavior of paramsSerializer does not encode square brackets. There cannot be brackets in place of the url parameter, and it should be encoded.
Looking at this pull request or this comment, This behavior seems to be intentional.
But according to the RFC 3986 cited there:
A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets (“[” and “]”). This is the only place where square bracket characters are allowed in the URI syntax.
(page 19)
URL parameter is not in this case. So I think brackets should be encoded in default behavior.
Example Code
axios.get('/test', {params: {a: '[]'}})
Expected behavior, if applicable
expected : request URL is https://domain.com/test?a=%5B%5D
actual: request URL is https://domain.com/test?a=[]
Environment
- Axios Version: 0.20.0
- Browser: Chrome
- Browser Version: 85.0.4183.121
Additional context/Screenshots
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:11 (2 by maintainers)
Regardless of server, the brackets should still be encoded by axios. What is the status of this?
Would greatly appreciate a merge of this PR… 😃