Fixed Content-Type of web api mapping returning JSON
ln.build - build0.waldrennach.l--n.de build job pending
Details
ln.build - build0.waldrennach.l--n.de build job pending
Details
parent
c3371bb0d8
commit
f73d32f066
|
@ -53,12 +53,13 @@ namespace ln.http.api
|
||||||
if (result is JSONValue jsonResult)
|
if (result is JSONValue jsonResult)
|
||||||
return defaultResponseFactory().Content(jsonResult);
|
return defaultResponseFactory().Content(jsonResult);
|
||||||
|
|
||||||
if (!JSONMapper.DefaultMapper.Serialize(result, out JSONValue json))
|
if (JSONMapper.DefaultMapper.Serialize(result, out JSONValue json))
|
||||||
return HttpResponse.InternalServerError().Content("Method result could not be serialized");
|
return defaultResponseFactory()
|
||||||
|
.ContentType("application/json")
|
||||||
result = json;
|
.Content(result.ToString())
|
||||||
|
;
|
||||||
return defaultResponseFactory().Content(result.ToString());
|
|
||||||
|
return HttpResponse.InternalServerError().Content("Method result could not be serialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapArguments(HttpRequest request, MethodInfo methodInfo,out object[] arguments, out Func<HttpResponse> defaultRepsonseFactory)
|
void MapArguments(HttpRequest request, MethodInfo methodInfo,out object[] arguments, out Func<HttpResponse> defaultRepsonseFactory)
|
||||||
|
|
Loading…
Reference in New Issue