Optionally avoid url encoding params
- Dominant language
- Elixir
- Stars
- 2.3k
- Forks
- 349
- PR merge metrics
- No merged PRs in 30d
Description
Hi is it possible to avoid running `URI.encode_query` on the passed in params?
Currently the params are always being run through `URI.encode_query` in https://github.com/edgurgel/httpoison/blob/a4a7877/lib/httpoison/base.ex#L162:
url =
cond do
not Keyword.has_key?(options, :params) -> url
URI.parse(url).query -> url <> "&" <> URI.encode_query(options[:params])
true -> url <> "?" <> URI.encode_query(options[:params])
end
I would like to not url-encode one of the params (because I need to avoid url-encoding the `,` character) for a particular API that I am working with. Do I have any alternatives beside running `URI.encode_query` on my other parameters and joining my non-encoded param manually with a `&`?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in lib/httpoison/base.ex at the URL construction around line 162, where options[:params] is passed to URI.encode_query in both query branches. Trace how request options are handled and determine an explicit way to make encoding optional for selected parameters. Done means the requested comma-preserving use case works while the current default parameter encoding remains unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100