aws-beam / aws-codegen

Code generator for AWS clients in Erlang and Elixir.
Other
53 stars 49 forks source link

Skip body encoding when payload requires a binary #62

Closed philss closed 3 years ago

philss commented 3 years ago

This is necessary to enable some operations like S3's "put object" to send the payload as a binary (a string or an binary representing a blob).

~A fix to Erlang REST template is coming soon~.

jfacorro commented 3 years ago

Is this related to issue #30?

philss commented 3 years ago

@jfacorro yes! I didn't see that issue :grimacing: Thanks for pointing out!
I think this fix covers all the services that enable the body as binary.

robertoaloi commented 3 years ago

Hi @philss

I'm getting an error in the Erlang library when trying to fetch from S3, since the client is trying to decode the non-decoded body of the response. I wonder if this is an issue of the Erlang generated module or if you have the same for Elixir. Would it be safe to assume that whenever the "send-body-as-binary" flag is set, the inbound/outbound procedure is the same?

robertoaloi commented 3 years ago

And looking at the actual code, it looks like we need to the same for the output/shape, cause this PR only addresses it for input/shape.

philss commented 3 years ago

Would it be safe to assume that whenever the "send-body-as-binary" flag is set, the inbound/outbound procedure is the same?

@robertoaloi I think there is a way to read that from the output shape. I will try to play with this. Also, I think this is a problem both for Erlang and Elixir.

In any case, can you open a new issue reporting the problem? Thanks!

robertoaloi commented 3 years ago

I think there is a way to read that from the output shape. I will try to play with this.

Yes, exactly what I found (see my second comment above). Opening a PR, at least for the Erlang part of it.