Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add content-type enforcement bypass for new infraction endpoint
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent 86f6729 commit 106cede
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion functions/_middleware.ts
Expand Up @@ -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: {
Expand Down

0 comments on commit 106cede

Please sign in to comment.