Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interceptor - query parameters are doubled #291

Open
Woren opened this issue Nov 1, 2023 · 0 comments
Open

Interceptor - query parameters are doubled #291

Woren opened this issue Nov 1, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Woren
Copy link

Woren commented Nov 1, 2023

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 Woren added the bug Something isn't working label Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants