Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#r "Newtonsoft.Json"
#r "..\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