예제 #1
0
        public Task <Stream> FunctionHandlerAsync(Stream inputStream)
        {
            var response = new LambdaResponse()
            {
                body = "Hello, I came from AWS Lambda"
            };

            return(Task.FromResult(ConvertToStream(response)));
        }
예제 #2
0
        private Stream ConvertToStream(LambdaResponse response)
        {
            var serializer = new Newtonsoft.Json.JsonSerializer();

            var memStream = new MemoryStream();
            var writer    = new StreamWriter(memStream);

            serializer.Serialize(writer, response);

            writer.Flush();

            memStream.Position = 0;

            return(memStream);
        }