Skip to content

Instantly share code, notes, and snippets.

@JeremyLikness
Created September 2, 2017 14:29
Show Gist options
  • Select an option

  • Save JeremyLikness/163a50b766e4c11d6971e8690b0725f1 to your computer and use it in GitHub Desktop.

Select an option

Save JeremyLikness/163a50b766e4c11d6971e8690b0725f1 to your computer and use it in GitHub Desktop.
Code to parse request
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, NextId keyTable, CloudTable tableOut, TraceWriter log)
{
if (req == null)
{
return req.CreateResponse(HttpStatusCode.NotFound);
}
Request input = await req.Content.ReadAsAsync<Request>();
if (input == null)
{
return req.CreateResponse(HttpStatusCode.NotFound);
}
var url = input.Input;
bool tagMediums = input.TagMediums.HasValue ? input.TagMediums.Value : true;
bool tagSource = (input.TagSource.HasValue ? input.TagSource.Value : true) || tagMediums;
if (String.IsNullOrWhiteSpace(url))
{
throw new Exception("Need a URL to shorten!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment