api cors
This commit is contained in:
@ -8,16 +8,19 @@ use yii\filters\AccessControl;
|
||||
use yii\filters\auth\CompositeAuth;
|
||||
use yii\filters\auth\HttpBearerAuth;
|
||||
use yii\filters\auth\QueryParamAuth;
|
||||
use yii\filters\ContentNegotiator;
|
||||
use yii\web\Response;
|
||||
|
||||
class SkillsController extends \yii\rest\Controller
|
||||
class SkillsController extends ApiController
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
$parent = parent::behaviors();
|
||||
$b = [
|
||||
[
|
||||
'class' => \yii\filters\ContentNegotiator::className(),
|
||||
'class' => ContentNegotiator::className(),
|
||||
'formats' => [
|
||||
'application/json' => \yii\web\Response::FORMAT_JSON,
|
||||
'application/json' => Response::FORMAT_JSON,
|
||||
],
|
||||
],
|
||||
'authenticator' => [
|
||||
@ -26,20 +29,9 @@ class SkillsController extends \yii\rest\Controller
|
||||
HttpBearerAuth::class,
|
||||
],
|
||||
]
|
||||
// 'corsFilter' => [
|
||||
// 'class' => GsCors::class,
|
||||
// 'cors' => [
|
||||
// 'Origin' => ['*'],
|
||||
// //'Access-Control-Allow-Credentials' => true,
|
||||
// 'Access-Control-Allow-Headers' => [
|
||||
// 'Content-Type',
|
||||
// 'Access-Control-Allow-Headers',
|
||||
// 'Authorization',
|
||||
// 'X-Requested-With'
|
||||
// ],
|
||||
// ]
|
||||
// ]
|
||||
];
|
||||
|
||||
return array_merge($parent, $b);
|
||||
}
|
||||
|
||||
public function actionIndex()
|
||||
|
Reference in New Issue
Block a user