$headers = Yii::$app->response->headers;
$headers->add('Content-Type', 'application/javascript');
return "console.log('hello');";Content-Type:text/html; charset=UTF-8
<response/>:public function actionSitemap()
{
$response = Yii::$app->response;
$response->format = Response::FORMAT_RAW;
$response->getHeaders()->set('Content-Type', 'application/xml; charset=utf-8');
return $this->render('sitemap');
} If there is already a header with the same name, the new one will be appended to it instead of replacing it.