public function init()
    {
        parent::init();

        //catch preflight request
        if ($this->request->httpMethod() === 'OPTIONS') {
            $answer = $this->answer(null, true);
            $answer->output();
            exit;
        }
    }
public function init()
    {
        parent::init();

        //catch preflight request
        if ($this->request->httpMethod() === 'OPTIONS') {
            $answer = $this->answer(null, true);
            $answer->output();
            exit;
        }
    }
public function init ( ) { parent :: init ( ) ; //catch preflight request if ( $ this -> request -> httpMethod ( ) === 'OPTIONS' ) { $ answer = $ this -> answer ( null , true ) ; $ answer -> output ( ) ; exit ; } }
Controller inititalisation
Catches CORS preflight request marked with HTTPMethod 'OPTIONS'
Controller inititalisation Catches CORS preflight request marked with HTTPMethod OPTIONS