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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow iodata body in s3 requests #1053

Merged
merged 1 commit into from
Jun 4, 2024

Conversation

ruslandoga
Copy link
Contributor

馃憢

This PR makes iodata ops possible in ExAws.S3.

@bernardd
Copy link
Contributor

bernardd commented Jun 4, 2024

Nice, thanks @ruslandoga, and apologies for the delay getting to this.

@bernardd bernardd merged commit 1602d4a into ex-aws:main Jun 4, 2024
13 checks passed
@ruslandoga
Copy link
Contributor Author

Thank you!

@ruslandoga
Copy link
Contributor Author

ruslandoga commented Jun 4, 2024

I missed

d when is_binary(d) -> d

Is there a way to allow iodata in that case statement?

  def request(http_method, url, data, headers, config, service) do
    body =
      case data do
        [] -> "{}"
        d when is_binary(d) or is_list(d) -> d
        _ -> config[:json_codec].encode!(data)
      end

    request_and_retry(http_method, url, service, config, headers, body, {:attempt, 1})
  end

could be problematic if non-encoded lists can come from other requests. Is it maybe possible to check by service if JSON encoding is required? I'll try to explore that route in a "encode to JSON only when necessary" PR.

@ruslandoga ruslandoga deleted the allow-iodata-body-in-s3-requests branch June 4, 2024 08:35
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

Successfully merging this pull request may close these issues.

None yet

2 participants