Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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