Request: support JSON as POST data format

refs #2749
This commit is contained in:
Alexander A. Klimov 2017-02-13 17:11:26 +01:00 committed by Eric Lippmann
parent adfcc5596e
commit a444b8adf5
1 changed files with 8 additions and 0 deletions

View File

@ -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);
}
}