pluto
pluto copied to clipboard
Interceptor - query parameters are doubled
Pluto version affected: 2.1.9 Pluto version which was working correctly: 2.1.3
When using addPlutoKtorInterceptor() requestBuilder.url(String) is called with existing URLBuilder, which will cause that query parameters in url are doubled. This is causing query parameters to look for example like this:
https://www.xyz.com/123?country=CZ&country=CZ&electronicContentOnly=False&electronicContentOnly=False https://www.xyz.com/123?country=CZ,CZ&country=CZ,CZ&electronicContentOnly=False,False&electronicContentOnly=False,False
The second variant is the invalid for server as "False,False" is incorrect value and the call will fail.
Problem can be solved like this: Method addPlutoKtorInterceptor() and inside it:
val callResult = try { requestUnBuilt.url.parametrs.clear() // this line is added, so query parameters cleared but taken inside "requestUnBuilt.url" requestUnBuilt.url(networkInterceptor.actualOrMockRequestUrl) execute(requestUnBuilt) } catch (e: IOException) { }
I hope that this is not issue for addPlutoOkhttpInterceptor() method, just double check it.
Thank you.
hey @Woren , can you confirm if you are still facing the issue on latest version?
I will check it out and get you the result. Thanks for the update!
I did the testing. This seems to be working now, but I cannot be 100% sure, because I found another problem. Please see another issue. Thank you.