Add content-type enforcement bypass for new infraction endpoint

This commit is contained in:
regalijan 2023-10-19 16:49:48 -04:00
parent 86f67294fb
commit 106cedec77
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -49,7 +49,10 @@ async function setAuth(context: RequestContext) {
}
async function setBody(context: RequestContext) {
if (context.request.method === "POST") {
if (
context.request.method === "POST" &&
!context.request.url.endsWith("/api/infractions/new")
) {
if (context.request.headers.get("content-type") !== "application/json")
return new Response('{"error":"Invalid content-type"}', {
headers: {