render( $params->getController(), $params->getAction(), $params->getData(), $params->initAuth() ); $this->clientManager->writeHeaders($response); $response->writeBody($body); } /** * @deprecated Use`write`. * @param ?array $data */ public function render(string $controller, string $action, ?array $data = null, bool $initAuth = false): string { $encodedData = Json::encode($data); $initAuthPart = $initAuth ? "app.initAuth();" : ''; $script = " {$initAuthPart} app.doAction({ controllerClassName: '{$controller}', action: '{$action}', options: {$encodedData}, }); "; return $this->clientManager->render($script); } }