public function answer($json = null, $corsPreflight = false)
{
$answer = new SS_HTTPResponse();
//set response body
if (!$corsPreflight) {
$answer->setBody($json);
}
//set CORS if needed
$answer = $this->setAnswerCORS($answer);
$answer->addHeader('Content-Type', $this->serializer->getcontentType());
// save controller's response then return/output
$this->response = $answer;
return $answer;
}