private Response PutTest(Request request) { var typedJson = new TestViewModel(); typedJson.PopulateFromJson(request.Body); try { return(new Response { Headers = { ["Access-Control-Allow-Origin"] = "*", ["Content-Type"] = "application/json" }, Body = _testRepository.AddOrUpdate(typedJson)?.ToJson(), StatusCode = (ushort)System.Net.HttpStatusCode.OK }); } catch (Exception ex) { return(new Response { Headers = { ["Access-Control-Allow-Origin"] = "*", ["Content-Type"] = "text/html" }, Body = ex.Message, StatusCode = (ushort)System.Net.HttpStatusCode.InternalServerError }); } }