aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/lib/exe/jsonrpc.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2023-11-28 16:47:44 +0100
committerAndreas Gohr <andi@splitbrain.org>2023-11-28 17:00:15 +0100
commit6f8e03f5bc790d26e1215349cea98d5a73654139 (patch)
tree0efa154b067b7a95158cdd287a7c4b076d40397d /lib/exe/jsonrpc.php
parent6fdb83b6d2daaf31fb295dd779e4b79c991e2473 (diff)
downloaddokuwiki-6f8e03f5bc790d26e1215349cea98d5a73654139.tar.gz
dokuwiki-6f8e03f5bc790d26e1215349cea98d5a73654139.zip
implement support for JSON-RPC 1.0, 1.1 and 2.0
This implements the slightly more standardized JSON-RPC standard as an alternative to my home-grown version. The same server handled all formats including my own simpler variant.
Diffstat (limited to 'lib/exe/jsonrpc.php')
-rw-r--r--lib/exe/jsonrpc.php16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/exe/jsonrpc.php b/lib/exe/jsonrpc.php
index 3852e2b45..48f22c7dc 100644
--- a/lib/exe/jsonrpc.php
+++ b/lib/exe/jsonrpc.php
@@ -11,21 +11,9 @@ header('Content-Type: application/json');
$server = new JsonRpcServer();
try {
- $result = [
- 'error' => [
- 'code' => 0,
- 'message' => 'success'
- ],
- 'data' => $server->serve(),
- ];
+ $result = $server->serve();
} catch (\Exception $e) {
- $result = [
- 'error' => [
- 'code' => $e->getCode(),
- 'message' => $e->getMessage()
- ],
- 'data' => null,
- ];
+ $result = $server->returnError($e);
}
echo json_encode($result);