-
Notifications
You must be signed in to change notification settings - Fork 350
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
feat: allow to specify encoding strategy for query params #558
feat: allow to specify encoding strategy for query params #558
Conversation
Related to: #538 |
Thank you so much for taking the time for this. I appreciate it. |
Any final thoughts related to our conversation? |
2bca420
to
fe7207c
Compare
Co-authored-by: Yordis Prieto <[email protected]>
7a3e513
to
715b75f
Compare
06906ef
to
c267bbd
Compare
@teamon share some love over here! Is the function changing from arity 2 to arity 3 with the default value any concern here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all backwards compatible, looks good to me!
I was adapting Tesla in a project when we encode query params with
:rfc3986
and I noticed that, while Tesla provides conveniences to build url encoding query params for us, it doesn't allow to specify the encoding strategy.TL;DR
This PR allows specifying option
query_encoding: :rfc3986
so that whitespaces in query params will be encoded as "%20".will build the following url
Also adds optional argument to
Tesla.build_url
andTesla.encode_query
.Tesla uses URI.encode_query/2 to encode query params. Since Elixir 1.12 that function allows to specify the encoding strategy.