I'm using Retrofit for my network layer in my Android app, but I have a problem with the URL encoding.
I have to call an REST API like that:
https://my_hostname.com/some_path?q=some_query¶m[0]=value1¶m[1]=value2&other_param=abcd
as you can see the query string is composed by some different kind of parameters, so I decided to use the @QueryMap annotation in the Retrofit Interface with a Map<String, String> where
q, param[1], param[0], other_param are String keys of the map
What do I expect?
I expect the square brackets in the URL are encoded with %5B for '[' and %5D for '[', but this does not happen.
Why does this happen? The square brackets should be encoded with percent encoding. Is this a bug or I'm doing something wrong? I also tried the @EncodedQueryMap annotation with no differences.
paramsto be an array of values - njzk2[]in variable names, but rather use that as everywhere else, as a list indicator, in which case the brackets should not need to be encoded. - njzk2