Query parameters with ListFormat.multiCompatible
still percent-encode square brackets
#2313
Labels
i: wontfix
This will not be worked on
Package
dio
Version
5.7.0
Operating-System
Android
Adapter
Default Dio
Output of
flutter doctor -v
No response
Dart Version
3.3.2
Steps to Reproduce
Even when specifying
ListFormat.multiCompatible
, square brackets ([]
) in query parameters are still percent-encoded.For example, the expected request is:
However, it is actually encoded as:
During debugging my app, it was found that the final URL is constructed in the
RequestOptions.url
getter usingUri.parse(url).normalizePath()
. In this process, it ends up encoding the square brackets regardless of thelistFormat
(the relevant code is here).I recently learned that RFC 3986 does not allow square brackets in query parameters. However, many major libraries, such as Laravel and Express, support the array syntax using square brackets in query strings, and it would be desirable for Dio to support this notation for compatibility reasons.
Expected Result
Actual Result
The text was updated successfully, but these errors were encountered: