protected function getHtmlResponse($action, $result, $params)
    {
        if (Yii::$app->response->format !== Response::FORMAT_HTML) {
            return false;
        }
        $headers = Yii::$app->response->getHeaders();
        if (($location = $headers->get('Location')) !== null) {
            return $this->redirect($location);
        }
        $content = Yii::$app->request->isAjax
            ? $this->renderAjax($action->viewName, $params)
            : $this->render($action->viewName, $params);
        return parent::afterAction($action, $content);
    }