mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 21:16:49 +00:00
fix(api): send proper content-type header for errors
This commit is contained in:
parent
cbef15eaa2
commit
0f47042dd1
2 changed files with 13 additions and 16 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue