From 34c7e11d84059136ac8f526a6e179b29e62c6025 Mon Sep 17 00:00:00 2001 From: wn_ Date: Mon, 2 Jun 2025 20:57:31 +0000 Subject: Use the official JSON MIME type of 'application/json'. --- backend.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'backend.php') diff --git a/backend.php b/backend.php index d9a0af7c7..6098333b7 100644 --- a/backend.php +++ b/backend.php @@ -35,7 +35,7 @@ return; } - header("Content-Type: text/json; charset=utf-8"); + header("Content-Type: application/json; charset=utf-8"); if (Config::get(Config::SINGLE_USER_MODE)) { UserHelper::authenticate("admin", null); @@ -43,7 +43,7 @@ if (!empty($_SESSION["uid"])) { if (!Sessions::validate_session()) { - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNAUTHORIZED); return; @@ -113,7 +113,7 @@ if (str_starts_with($method, "_")) { user_error("Refusing to invoke method $method of handler $op which starts with underscore.", E_USER_WARNING); - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNAUTHORIZED); return; @@ -142,7 +142,7 @@ $handler->$method(); } else { user_error("Refusing to invoke method $method of handler $op which has required parameters.", E_USER_WARNING); - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNAUTHORIZED); } @@ -150,7 +150,7 @@ if (method_exists($handler, "catchall")) { $handler->catchall($method); } else { - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNKNOWN_METHOD, ["info" => get_class($handler) . "->$method"]); } @@ -159,14 +159,14 @@ $handler->after(); return; } else { - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNAUTHORIZED); return; } } else { user_error("Refusing to invoke method $method of handler $op with invalid CSRF token.", E_USER_WARNING); - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNAUTHORIZED); return; @@ -174,6 +174,6 @@ } } - header("Content-Type: text/json"); + header("Content-Type: application/json"); print Errors::to_json(Errors::E_UNKNOWN_METHOD, [ "info" => (isset($handler) ? get_class($handler) : "UNKNOWN:".$op) . "->$method"]); -- cgit v1.2.3-54-g00ecf