Created
September 2, 2017 14:29
-
-
Save JeremyLikness/163a50b766e4c11d6971e8690b0725f1 to your computer and use it in GitHub Desktop.
Code to parse request
This file contains hidden or 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 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