Request: Parse the POST body only as JSON if it's really JSON
refs #3484
This commit is contained in:
parent
842e5603a1
commit
8cbff87af1
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue