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

Problem with Req HTTP Client #1086

Open
nicanor opened this issue Sep 10, 2024 · 0 comments
Open

Problem with Req HTTP Client #1086

nicanor opened this issue Sep 10, 2024 · 0 comments

Comments

@nicanor
Copy link

nicanor commented Sep 10, 2024

I tried to use the new Req HTTPClient, but it failed me when trying to download from S3 via stream

(ex_aws_s3 2.5.4) lib/ex_aws/s3/download.ex:98: ExAws.Operation.ExAws.S3.Download.stream!/2
(ex_aws_s3 2.5.4) lib/ex_aws/s3/download.ex:28: ExAws.S3.Download.build_chunk_stream/2
:erlang.binary_to_integer(["3047599"])
* 1st argument: not a binary

Problem is that the headers have a different format for Req.

I fixed the error by adding these lines to the response (I took them from your documentation in HTTP Client module):

headers =
  Enum.flat_map(headers, fn
    {name, vals} when is_list(vals) -> Enum.map(vals, &{name, &1})
    {name, val} -> {name, val}
  end)

This small change in ExAws.Request.Req fixed all my problems.

Please let me know if you need any more information

I'm happy to do the change myself if you want me to.
In that case, please give me some instructions on how to contribute.

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