Created
May 8, 2016 18:16
-
-
Save guitarrapc/404bcc9ed30823328cf0e3cb75753acf to your computer and use it in GitHub Desktop.
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
#r "Newtonsoft.Json" | |
#r "D:\home\site\wwwroot\MyExtensions.dll" | |
using System; | |
using System.Net; | |
using Newtonsoft.Json; | |
using MyExtensions; | |
public static async Task<object> Run(HttpRequestMessage req, TraceWriter log) | |
{ | |
log.Info($"Webhook was triggered!"); | |
string jsonContent = await req.Content.ReadAsStringAsync(); | |
dynamic data = JsonConvert.DeserializeObject(jsonContent); | |
if (data.first == null || data.last == null) { | |
return req.CreateResponse(HttpStatusCode.BadRequest, new { | |
error = "Please pass first/last properties in the input object" | |
}); | |
} | |
log.Verbose(typeof(EnumerableExtensions).ToString()); | |
var hoge = new [] {"hoge", "fuga"}.ToJoinedString(", "); | |
return req.CreateResponse(HttpStatusCode.OK, new { | |
greeting = $"Hello {data.first} {data.last}!" | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment