fix(api): send proper content-type header for errors

This commit is contained in:
spiral
2022-06-10 16:44:04 -04:00
parent cbef15eaa2
commit 0f47042dd1
2 changed files with 13 additions and 16 deletions

View File

@@ -1,3 +1,5 @@
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -37,6 +39,13 @@ public static class APIJsonExt
return o;
}
public static async Task WriteJSON(this HttpResponse resp, int statusCode, string jsonText)
{
resp.StatusCode = statusCode;
resp.Headers.Add("content-type", "application/json");
await resp.WriteAsync(jsonText);
}
}
public struct FrontersReturnNew