Skip to content

Commit

Permalink
Add X-PJAX-URL header when redirect a pjax request
Browse files Browse the repository at this point in the history
  • Loading branch information
tof06 committed Feb 24, 2014
1 parent 8c1d39b commit 6176786
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion framework/web/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,9 @@ public function redirect($url, $statusCode = 302)
$url = Yii::$app->getRequest()->getHostInfo() . $url;
}

if (Yii::$app->getRequest()->getIsAjax()) {
if (Yii::$app->getRequest()->getIsPjax()) {
$this->getHeaders()->set('X-PJAX-URL', $url);
} elseif (Yii::$app->getRequest()->getIsAjax()) {
$this->getHeaders()->set('X-Redirect', $url);
} else {
$this->getHeaders()->set('Location', $url);
Expand Down

0 comments on commit 6176786

Please sign in to comment.