-
-
Save liorksh/de8bfabe2bd5dd08946d3e7c70e903eb to your computer and use it in GitHub Desktop.
Lambda input stream
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public APIGatewayProxyResponse StreamHandler(Stream input, ILambdaContext context) | |
{ | |
string inputString = string.Empty; | |
LambdaLogger.Log("started 'FunctionHandler' method"); | |
if (input != null) | |
{ | |
StreamReader streamReader = new StreamReader(input); | |
inputString = streamReader.ReadToEnd(); | |
if (inputString.IndexOf("name") > 0) | |
{ | |
inputString = inputString.Substring(inputString.IndexOf("name"), 6); | |
} | |
} | |
inputString = "received the following string: " + inputString; | |
var response = new APIGatewayProxyResponse | |
{ | |
StatusCode = (int)HttpStatusCode.OK, | |
Body = inputString + DateTime.Now.ToString("hh:mm:ss"), | |
Headers = new Dictionary<string, string> { { "Content-Type", "text/plain" } } | |
}; | |
return response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment