<?php

namespace common\helpers;
use Yii;

use yii\filters\Cors;


class CorsCustom extends Cors
{

    public function beforeAction($action){

        $result = parent::beforeAction($action);

        if (Yii::$app->getRequest()->getMethod() === 'OPTIONS') {
            Yii::$app->getResponse()->getHeaders()->set('Allow', 'POST GET PUT');
            Yii::$app->end();
        }

        return $result;

    }

}
