New: Use ASP.NET Core instead of Nancy

This commit is contained in:
ta264
2021-03-11 20:56:24 +00:00
parent d348232e0d
commit 58ddbcd77e
158 changed files with 2747 additions and 3544 deletions
+12 -1
View File
@@ -1,4 +1,8 @@
using Readarr.Http.Exceptions;
using System.Net;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using NzbDrone.Common.Serializer;
using Readarr.Http.Exceptions;
namespace Readarr.Http.ErrorManagement
{
@@ -17,5 +21,12 @@ namespace Readarr.Http.ErrorManagement
public ErrorModel()
{
}
public Task WriteToResponse(HttpResponse response, HttpStatusCode statusCode = HttpStatusCode.InternalServerError)
{
response.StatusCode = (int)statusCode;
response.ContentType = "application/json";
return STJson.SerializeAsync(this, response.Body);
}
}
}