diff --git a/ln.http.api/WebApiController.cs b/ln.http.api/WebApiController.cs index c74ca9a..eab368b 100644 --- a/ln.http.api/WebApiController.cs +++ b/ln.http.api/WebApiController.cs @@ -53,12 +53,13 @@ namespace ln.http.api if (result is JSONValue jsonResult) return defaultResponseFactory().Content(jsonResult); - if (!JSONMapper.DefaultMapper.Serialize(result, out JSONValue json)) - return HttpResponse.InternalServerError().Content("Method result could not be serialized"); - - result = json; - - return defaultResponseFactory().Content(result.ToString()); + if (JSONMapper.DefaultMapper.Serialize(result, out JSONValue json)) + return defaultResponseFactory() + .ContentType("application/json") + .Content(result.ToString()) + ; + + return HttpResponse.InternalServerError().Content("Method result could not be serialized"); } void MapArguments(HttpRequest request, MethodInfo methodInfo,out object[] arguments, out Func defaultRepsonseFactory)