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
Open
Description
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
isBody::Text
->is_base64_encoded = false
. - If
body
isBody::Binary
->is_base64_encoded = true
. - If
body
isBody::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?