From 24b93875fda26dcb2f9fc07b9c762533c7c1814d Mon Sep 17 00:00:00 2001 From: Alex Hyett Date: Wed, 12 Dec 2018 13:22:47 +0000 Subject: [PATCH] Return json from response --- src/ContactForm/Function.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ContactForm/Function.cs b/src/ContactForm/Function.cs index dfc839e..cc67dff 100644 --- a/src/ContactForm/Function.cs +++ b/src/ContactForm/Function.cs @@ -11,6 +11,7 @@ using ContactForm.Models; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Serilog; @@ -31,7 +32,8 @@ namespace ContactForm /// /// /// string - public string FunctionHandler(ContactRequest input, ILambdaContext context) + [LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))] + public object FunctionHandler(ContactRequest input, ILambdaContext context) { var configuration = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) @@ -58,7 +60,7 @@ namespace ContactForm appService.Run(input).GetAwaiter().GetResult(); Log.CloseAndFlush(); - return "OK"; + return new { location = "https://www.alexhyett.com" }; } private void ConfigureServices(IServiceCollection serviceCollection)