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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When implementing Controllers using lambdas, handle "Accepted-Encoding" and "Encoded-Content" headers transparently to decide if lambda response should be binary. #1953

Open
dniel opened this issue Nov 15, 2023 · 2 comments

Comments

@dniel
Copy link

dniel commented Nov 15, 2023

Feature description

When using the API-Gateway to integrate with a AWS Lambda its easy to reach the 6mb limit of lambda payload response if returning plain text response. A http client should be able to send Accepted-Encoding to gzip and expect the response to be gzipped and the Encoded-Content header in the result to be set to gzip.

Implementing a AWS Lambda using @Controller and annotations such as @Get should handle Accepted-Encoding header to decide it should gzip the response and set isBase64Encoded=true in response transparently for the user just like when handling request when running as a netty container.

Example

@Controller
class RestApiController(){

  @Get("/something")
    fun getSomething(): HttpResponse{
       val giganticResponse = ... // something 10 mb from the database
      
       // should be gzipped to avoid aws limit to 6mb payload response.
       // especially if incoming header from API-Gateway Accept-Content has "gzip"
       return HttpResponse.ok(giganticResponse)
    }
}
@sdelamo
Copy link
Contributor

sdelamo commented Nov 15, 2023

@timyates can you look into this?

@dniel I think if your controller returned HttpResponse.contentType("application/zip").body(bytes) you will get what you are looking for.

@dniel
Copy link
Author

dniel commented Nov 15, 2023

thanx! I will try that.

@sdelamo sdelamo removed this from 4.3.0 Release Jan 26, 2024
@timyates timyates removed their assignment May 28, 2024
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

No branches or pull requests

3 participants