Handle clients that include the charset
This commit is contained in:
parent
161862712c
commit
212d8042c2
@ -195,7 +195,11 @@ async function setBody(context: RequestContext) {
|
|||||||
context.request.method === "POST" &&
|
context.request.method === "POST" &&
|
||||||
!context.request.url.endsWith("/api/infractions/new")
|
!context.request.url.endsWith("/api/infractions/new")
|
||||||
) {
|
) {
|
||||||
if (context.request.headers.get("content-type") !== "application/json")
|
if (
|
||||||
|
!context.request.headers
|
||||||
|
.get("content-type")
|
||||||
|
?.startsWith("application/json")
|
||||||
|
)
|
||||||
return new Response('{"error":"Invalid content-type"}', {
|
return new Response('{"error":"Invalid content-type"}', {
|
||||||
headers: {
|
headers: {
|
||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user