Request: Parse the POST body only as JSON if it's really JSON

refs #3484
This commit is contained in:
Johannes Meyer 2018-06-27 10:26:53 +02:00 committed by Eric Lippmann
parent 842e5603a1
commit 8cbff87af1
1 changed files with 5 additions and 3 deletions

View File

@ -124,9 +124,11 @@ class Request extends Zend_Controller_Request_Http
public function getPost($key = null, $default = null) public function getPost($key = null, $default = null)
{ {
return $key === null && $this->isApiRequest() if ($key === null && $this->extractMediaType($this->getHeader('Content-Type')) === 'application/json') {
? Json::decode(file_get_contents('php://input'), true) return Json::decode(file_get_contents('php://input'), true);
: parent::getPost($key, $default); }
return parent::getPost($key, $default);
} }
/** /**