JsonResponse: Set content type at initialization and not at sendHeaders

refs #12161
This commit is contained in:
Noah Hilverling 2016-10-17 16:33:51 +02:00
parent c3276d4341
commit 703561f874
1 changed files with 7 additions and 9 deletions

View File

@ -67,6 +67,13 @@ class JsonResponse extends Response
*/
protected $successData;
/**
* Content type of this response
*
* @var string
*/
protected $contentType = 'application/json';
/**
* Get the JSON encoding options
*
@ -186,15 +193,6 @@ class JsonResponse extends Response
echo json_encode($body, $this->getEncodingOptions());
}
/**
* {@inheritdoc}
*/
public function sendHeaders()
{
$this->setContentType('application/json');
parent::sendHeaders();
}
/**
* {@inheritdoc}
*/