Skip to content
This repository was archived by the owner on May 16, 2023. It is now read-only.
This repository was archived by the owner on May 16, 2023. It is now read-only.

AlbTargetGroupResponse automatically base64 encodes data #49

Description

@WhyNotHugo

I'm using this to return some image data from a lambda:

    let resp = AlbTargetGroupResponse {
        status_code: 200,
        body: Some(Body::Binary(buf)),
        headers: HeaderMap::new(),
        is_base64_encoded: true,
        multi_value_headers: HeaderMap::new(),
        status_description: Some(String::from("200 OK")),
    };

It appears that when using body: Some(Body::Binary(buf)), this library automatically encodes the payload in base64.

In this case, is_base64_encoded should be set to true. However, it might make sense to drop the is_base64_encoded field entirely, and auto-generate that based on the type of body:

  • If body is Body::Text -> is_base64_encoded = false.
  • If body is Body::Binary -> is_base64_encoded = true.
  • If body is Body::Empty -> irrelevant...?

Given that most of the code around this is auto-generated, I'm not sure if this is even possible.

Are there any fields that are auto-generated based on other's value? Do you think my suggestion makes sense, or is it simpler to just add a note in the docs explaining that binary content is always base64 encoded?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions