public function answer($json = null, $corsPreflight = false)
    {
        $answer = new 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;
    }