Can someone tell me how to return a stream from an AWS Api Gateway? My API calls a lambda written in C#, which successfully returns a string, but I don't know how to modify it to return a stream. I need this because it will be used to download a zipped file that is 100MB.
This is a simplified version of my current lambda handler.
public APIGatewayHttpApiV2ProxyResponse MainHandler(APIGatewayProxyRequest request, ILambdaContext context)
{
...
var response = new APIGatewayHttpApiV2ProxyResponse
{
StatusCode = (int)HttpStatusCode.OK,
Body = "MainHandler was called",
Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } }
};
return response;
}
I don't know how to modify this to return a stream, instead of text.
I have found examples of how to consume a stream using HttpClient:
c#: How to Post async request and get stream with httpclient?
but no examples of how to create one from AWS.