diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2025-06-03 16:57:15 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2025-06-03 16:57:15 +0300 |
| commit | 87fb1de91dda98c3deeb89b2c58548d5d8c4faf6 (patch) | |
| tree | fcc415f1ad6eaa94f8be2e3fe3a0c8c178f6abfe /backend.php | |
| parent | 20950525216a45565953004f785ebbcbdded31b9 (diff) | |
| parent | 34c7e11d84059136ac8f526a6e179b29e62c6025 (diff) | |
Merge branch 'feature/json-mime-type' into 'master'
Use the official JSON MIME type of 'application/json'
See merge request tt-rss/tt-rss!146
Diffstat (limited to 'backend.php')
| -rw-r--r-- | backend.php | 16 |
1 files changed, 8 insertions, 8 deletions
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"]); |