original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Output the API response to client
  then exit.
  
  @param  string $json Response body
  @param  boolean $corsPreflight Set to true if this is a XHR preflight request answer. CORS shoud be enabled.
  @return HTTPResponse
docstring_tokens: Output the API response to client then exit .