Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created May 8, 2016 18:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/404bcc9ed30823328cf0e3cb75753acf to your computer and use it in GitHub Desktop.
Save guitarrapc/404bcc9ed30823328cf0e3cb75753acf to your computer and use it in GitHub Desktop.
#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