summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorwn_ <invalid@email.com>2025-06-02 20:57:31 +0000
committerwn_ <invalid@email.com>2025-06-03 13:53:12 +0000
commit34c7e11d84059136ac8f526a6e179b29e62c6025 (patch)
treefcc415f1ad6eaa94f8be2e3fe3a0c8c178f6abfe /classes
parent20950525216a45565953004f785ebbcbdded31b9 (diff)
Use the official JSON MIME type of 'application/json'.
Diffstat (limited to 'classes')
-rw-r--r--classes/API.php2
-rw-r--r--classes/Handler_Public.php10
2 files changed, 6 insertions, 6 deletions
diff --git a/classes/API.php b/classes/API.php
index e1d4de214..03f5a2502 100644
--- a/classes/API.php
+++ b/classes/API.php
@@ -30,7 +30,7 @@ class API extends Handler {
function before(string $method): bool {
if (parent::before($method)) {
- header("Content-Type: text/json");
+ header("Content-Type: application/json");
if (empty($_SESSION["uid"]) && $method != "login" && $method != "isloggedin") {
$this->_wrap(self::STATUS_ERR, array("error" => self::E_NOT_LOGGED_IN));
diff --git a/classes/Handler_Public.php b/classes/Handler_Public.php
index 36820ab13..347a38381 100644
--- a/classes/Handler_Public.php
+++ b/classes/Handler_Public.php
@@ -248,7 +248,7 @@ class Handler_Public extends Handler {
array_push($feed['articles'], $article);
}
- header("Content-Type: text/json; charset=utf-8");
+ header("Content-Type: application/json; charset=utf-8");
print json_encode($feed);
} else {
@@ -320,7 +320,7 @@ class Handler_Public extends Handler {
header("Location: " . $redirect_url);
} else {
- header("Content-Type: text/json");
+ header("Content-Type: application/json");
print Errors::to_json(Errors::E_UNAUTHORIZED);
}
}
@@ -806,17 +806,17 @@ class Handler_Public extends Handler {
$plugin->$method();
} else {
user_error("PluginHandler[PUBLIC]: Requested private method '$method' of plugin '$plugin_name'.", E_USER_WARNING);
- header("Content-Type: text/json");
+ header("Content-Type: application/json");
print Errors::to_json(Errors::E_UNAUTHORIZED);
}
} else {
user_error("PluginHandler[PUBLIC]: Requested unknown method '$method' of plugin '$plugin_name'.", E_USER_WARNING);
- header("Content-Type: text/json");
+ header("Content-Type: application/json");
print Errors::to_json(Errors::E_UNKNOWN_METHOD);
}
} else {
user_error("PluginHandler[PUBLIC]: Requested method '$method' of unknown plugin '$plugin_name'.", E_USER_WARNING);
- header("Content-Type: text/json");
+ header("Content-Type: application/json");
print Errors::to_json(Errors::E_UNKNOWN_PLUGIN, ['plugin' => $plugin_name]);
}
}