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

Query parameters are not being encoded correctly #15

Closed
javichaques opened this issue Jul 11, 2022 · 4 comments
Closed

Query parameters are not being encoded correctly #15

javichaques opened this issue Jul 11, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@javichaques
Copy link

Describe the bug
Query parameters are not being encoded correctly, I think it's encoding it twice

To Reproduce
Captura de Pantalla 2022-07-11 a las 15 27 37

startDate = 2022-07-10T00:00
endDate = 2022-07-13T23:59
timeTrunc = hour

This should the url
https://apidatos.ree.es/es/datos/mercados/precios-mercados-tiempo-real?start_date=2022-07-10T00:00&end_date=2022-07-13T23:59&time_trunc=hour
and encoded url
https://apidatos.ree.es/es/datos/mercados/precios-mercados-tiempo-real?start_date=2022-07-10T00%3A00&end_date=2022-07-13T23%3A59&time_trunc=hour

but app is calling this url:
https://apidatos.ree.es/es/datos/mercados/precios-mercados-tiempo-real?start_date=2022-07-10T00%253A00&end_date=2022-07-13T23%253A59&time_trunc=hour

Software used

Android Studio Chipmunk | 2021.2.1 Patch 1
Kotlin v1.7.0
KSP 1v.7.0-1.0.6
Ktor v2.0.3
Ktorfit v1.0.0-beta08
@Foso
Copy link
Owner

Foso commented Jul 11, 2022

Thank you for reporting,

@Foso Foso self-assigned this Jul 11, 2022
Foso added a commit that referenced this issue Jul 13, 2022
* move annotations

* #15: fix multiple encoding of query parameters

* update version number
@Foso
Copy link
Owner

Foso commented Jul 13, 2022

You were right about the double encoding. I didn't noticed that Ktor adds an encoding to parameters by default. I fixed it with beta09

@javichaques
Copy link
Author

It's work fine in beta09, thanks @Foso !

@DanielNovak
Copy link

@Foso is this also fixed for @FormUrlEncoded? I am on beta09 and a PUT request has Field parameters encoded twice. So for example @ is converted to %2540 instead of %40.

@Foso Foso added the bug Something isn't working label Aug 18, 2022
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

3 participants