app/models/Data/RequestMeta.php: in getBody() prettyprint some json :)
This commit is contained in:
parent
ccc8ae033a
commit
2efebfbfef
1 changed files with 8 additions and 1 deletions
|
|
@ -3,6 +3,7 @@
|
||||||
namespace App\Model\Data;
|
namespace App\Model\Data;
|
||||||
|
|
||||||
use Phalcon\Mvc\Model;
|
use Phalcon\Mvc\Model;
|
||||||
|
use Localheinz\Json\Printer\Printer as JsonPrinter;
|
||||||
|
|
||||||
class RequestMeta extends Model
|
class RequestMeta extends Model
|
||||||
{
|
{
|
||||||
|
|
@ -239,7 +240,13 @@ class RequestMeta extends Model
|
||||||
|
|
||||||
public function getBody()
|
public function getBody()
|
||||||
{
|
{
|
||||||
return $this->getRequestObject()->getBody();
|
$body = $this->getRequestObject()->getBody();
|
||||||
|
|
||||||
|
if ($this->getType() == 'json') {
|
||||||
|
$printer = new JsonPrinter();
|
||||||
|
return $printer->print($body, ' ');
|
||||||
|
}
|
||||||
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Reference in a new issue