pluto icon indicating copy to clipboard operation
pluto copied to clipboard

Interceptor - query parameters are doubled

Open Woren opened this issue 2 years ago • 3 comments

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.

Woren avatar Nov 01 '23 13:11 Woren

hey @Woren , can you confirm if you are still facing the issue on latest version?

srtvprateek avatar Mar 04 '25 17:03 srtvprateek

I will check it out and get you the result. Thanks for the update!

Woren avatar Mar 11 '25 12:03 Woren

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.

Woren avatar Mar 21 '25 12:03 Woren