public function behaviors()
{
return [
'verbs' => [
'class' => \yii\filters\VerbFilter::className(),
'actions' => [
'index' => ['GET'],
'truck' => ['POST', "DELETE"],
'polygon' => ['POST', "DELETE"],
'marker' => ['POST', "DELETE"],
'line-string' => ['POST', "DELETE"],
],
],
];
}
Yii::$app->request->parsers = [
'application/json' => 'yii\web\JsonParser'
];
Yii::$app->response->format = Response::FORMAT_JSON;
public function behaviors()
{
return [
[
'class' => 'yii\filters\ContentNegotiator',
'only' => ['view', 'index'], // in a controller
// if in a module, use the following IDs for user actions
// 'only' => ['user/view', 'user/index']
'formats' => [
'application/json' => Response::FORMAT_JSON,
],
'languages' => [
'en',
'de',
],
],
];
}