yii\web\User::checkRedirectAcceptable PHP Method

checkRedirectAcceptable() protected method

The login page is assumed to serve text/html or application/xhtml+xml by default. You can change acceptable content types by modifying [[acceptableRedirectTypes]] property.
See also: acceptableRedirectTypes
Since: 2.0.8
protected checkRedirectAcceptable ( ) : boolean
return boolean whether this request may be redirected to the login page.
    protected function checkRedirectAcceptable()
    {
        $acceptableTypes = Yii::$app->getRequest()->getAcceptableContentTypes();
        if (empty($acceptableTypes) || count($acceptableTypes) === 1 && array_keys($acceptableTypes)[0] === '*/*') {
            return true;
        }
        foreach ($acceptableTypes as $type => $params) {
            if (in_array($type, $this->acceptableRedirectTypes, true)) {
                return true;
            }
        }
        return false;
    }