From a444b8adf5491d45f7ee7aff9259c4618308f140 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 13 Feb 2017 17:11:26 +0100 Subject: [PATCH] Request: support JSON as POST data format refs #2749 --- library/Icinga/Web/Request.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/Icinga/Web/Request.php b/library/Icinga/Web/Request.php index bedcd44d7..88fb729cb 100644 --- a/library/Icinga/Web/Request.php +++ b/library/Icinga/Web/Request.php @@ -3,6 +3,7 @@ namespace Icinga\Web; +use Icinga\Util\Json; use Zend_Controller_Request_Http; use Icinga\Application\Icinga; use Icinga\User; @@ -120,4 +121,11 @@ class Request extends Zend_Controller_Request_Http return $id . '-' . $this->uniqueId; } + + public function getPost($key = null, $default = null) + { + return $key === null && $this->isApiRequest() + ? Json::decode(file_get_contents('php://input'), true) + : parent::getPost($key, $default); + } }