-
Notifications
You must be signed in to change notification settings - Fork 361
lambda_http: Use http_body::Body for responses #409
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
Comments
This will be very useful. For example, in AWS Lambda Adapter, I have to convert from reqwest::Response to lambda_http::LambdaResponse. If this conversion is handled by lambda-http, it will help to remove big chunck of code from Lambda Adapter. |
I think we need to see before/after examples of how this would work. |
this can be closed as fixed now, can't it? |
Yes, this was done in #491. |
|
Since #406,
lambda_http::Body
implementshttp_body::Body
. However,lambda_http::LambdaResponse
only acceptslambda_http::Body
as response body.With this proposal, we could create a
LambdaResponse
from anyRequest<http_body::Body>
, which means Lambda functions could return anything that implements this trait.Drawbacks
Right now, we support receiving a
serde_json::Value
or other values that implementInto<Body>
because we use a custom type.I think this would no longer be possible if we accept a foreign trait, or would involve a bit more complexities on the implementation side.
The text was updated successfully, but these errors were encountered: