8000 Allow setting Ethon option `params_encoding` · Issue #726 · typhoeus/typhoeus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Allow setting Ethon option params_encoding #726

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 email 7E15 s.

Already on GitHub? Sign in to your account

Open
zealot128 opened this issue Oct 8, 2024 · 0 comments
Open

Allow setting Ethon option params_encoding #726

zealot128 opened this issue Oct 8, 2024 · 0 comments

Comments

@zealot128
Copy link

I have a specific API I want to access, that combines File-uploads with a different scheme of array encoding.

It's the API of the OpenSource DMS "Paperless-NGX" - They allow uploading a document file and specifying a list of tag-ids in multi format, e.g. "tags=1&tags=5&tags=10"

See doc: https://docs.paperless-ngx.com/api/#file-uploads

Luckily, Ethon already supports those nested params format at https://github.com/typhoeus/ethon/blob/6b0260dd6f9bf3b6491d9c2ccab104b8b71db108/lib/ethon/easy/queryable.rb#L101

With params_encoding in [:none, :rack, :multi] -> In my case I would need multi.

But I didn't find a way to pass those encoding option down into the request.
I tried: Typhoeus.post(..., body: {}, params_encoding: :multi), but the whole code base of Typhoeus does not mention "params_encoding" at all, and I tried following the callchain into Ethon http_request / fabricate but found no obvious way.

In my case, the solution was to monkey patch Ethon:

class Ethon::Easy::Form
  def params_encoding = :multi
end

Maybe I overlooked the option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant
0