Skip to content

Commit

Permalink
POST request bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
volbil committed Sep 3, 2018
1 parent 29614b1 commit 8191f8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/index.php
Expand Up @@ -4,13 +4,14 @@

$timeout = 10; // seconds
$rpc_url = "";
$method = isset($_SERVER["REQUEST_METHOD"]) ? $_SERVER["REQUEST_METHOD"] : "GET";
$error = [
"not-responding" => '{"jsonrpc": "2.0", "error": {"code": -32001, "message": "Server Not Responding"}, "id": null}',
"invalid-request" => '{"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": null}'
];

if (in_array($_SERVER["REQUEST_METHOD"], ["GET", "POST"])) {
$request = isset($_GET) ? $_GET : $_POST;
if (in_array($method, ["GET", "POST"])) {
$request = ($method == "GET") ? $_GET : $_POST;

$params = json_encode([
"jsonrpc" => "2.0",
Expand Down

0 comments on commit 8191f8b

Please sign in to comment.