|
@@ -209,10 +209,12 @@ class Response
|
|
|
switch ($this->data['format']) {
|
|
|
case self::FORMAT_JSON:
|
|
|
$this->setHeader('Status', $code);
|
|
|
- $this->setHeader('Content-Type', 'text/json');
|
|
|
+ $this->setHeader('Content-Type', 'application/json');
|
|
|
$this->sendHeaders();
|
|
|
$headerIsSent = true;
|
|
|
echo json_encode($this->data['body'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
|
|
|
+ //clear body
|
|
|
+ unset($this->data['body']);
|
|
|
break;
|
|
|
default:
|
|
|
$this->setHeader('Status', $code);
|
|
@@ -231,7 +233,8 @@ class Response
|
|
|
$body = Response::$render->fetch($this->data['body']['tpl']);
|
|
|
}
|
|
|
}
|
|
|
- //$this->setBody($body);
|
|
|
+ //clear body
|
|
|
+ unset($this->data['body']);
|
|
|
echo(IS_CLI ? (new Cli())->stdout($body) : $body);
|
|
|
break;
|
|
|
}
|