mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-14 05:08:42 +08:00
Enhanced 9f499eb: yii\web\User::checkRedirectAcceptable() removed check for "*" type (invalid in accept header)
This commit is contained in:
@@ -210,17 +210,18 @@ class UserTest extends TestCase
|
||||
|
||||
$this->reset();
|
||||
Yii::$app->request->setUrl('accept-all');
|
||||
$_SERVER['HTTP_ACCEPT'] = '*;q=0.1';
|
||||
$_SERVER['HTTP_ACCEPT'] = '*/*;q=0.1';
|
||||
$user->loginRequired();
|
||||
$this->assertEquals('accept-all', $user->getReturnUrl());
|
||||
$this->assertTrue(Yii::$app->response->getIsRedirection());
|
||||
|
||||
$this->reset();
|
||||
Yii::$app->request->setUrl('accept-all');
|
||||
$_SERVER['HTTP_ACCEPT'] = '*/*;q=0.1';
|
||||
$user->loginRequired();
|
||||
$this->assertEquals('accept-all', $user->getReturnUrl());
|
||||
$this->assertTrue(Yii::$app->response->getIsRedirection());
|
||||
Yii::$app->request->setUrl('json-and-accept-all');
|
||||
$_SERVER['HTTP_ACCEPT'] = 'text/json, */*; q=0.1';
|
||||
try {
|
||||
$user->loginRequired();
|
||||
} catch (ForbiddenHttpException $e) {}
|
||||
$this->assertFalse(Yii::$app->response->getIsRedirection());
|
||||
|
||||
$this->reset();
|
||||
Yii::$app->request->setUrl('accept-html-json');
|
||||
|
||||
Reference in New Issue
Block a user