Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Last active July 23, 2017 12:24
Show Gist options
  • Save justinyoo/c1aecd1bed6d24459c8909342febce8a to your computer and use it in GitHub Desktop.
Save justinyoo/c1aecd1bed6d24459c8909342febce8a to your computer and use it in GitHub Desktop.
Testing Serverless Applications - Part 2
// Returns OK (200) response
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, ILogger log)
{
var settings = new JsonSerializerSettings()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore
};
var formatter = new JsonMediaTypeFormatter() { SerializerSettings = settings };
var models = new List<ContentModel>()
{
new ContentModel() { Name = "abc", Url = "https://templates.io/abc" },
new ContentModel() { Name = "xya", Url = "https://templates.io/xyz" }
};
return req.CreateResponse(HttpStatusCode.OK, models, formatter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment