mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-12 20:21:19 +08:00
fix 'unafe' typo
This commit is contained in:
@@ -140,7 +140,7 @@ class Request extends \yii\base\Request
|
|||||||
* This property is used only when both [[enableCsrfValidation]] and [[validateCsrfHeaderOnly]] are true.
|
* This property is used only when both [[enableCsrfValidation]] and [[validateCsrfHeaderOnly]] are true.
|
||||||
* @see https://fetch.spec.whatwg.org/#http-cors-protocol
|
* @see https://fetch.spec.whatwg.org/#http-cors-protocol
|
||||||
*/
|
*/
|
||||||
public $csrfHeaderUnafeMethods = ['GET', 'HEAD', 'POST'];
|
public $csrfHeaderUnsafeMethods = ['GET', 'HEAD', 'POST'];
|
||||||
/**
|
/**
|
||||||
* @var bool whether to use custom header only to CSRF validation of SPA. Defaults to false.
|
* @var bool whether to use custom header only to CSRF validation of SPA. Defaults to false.
|
||||||
* If false and [[enableCsrfValidation]] is true, CSRF validation by token will used.
|
* If false and [[enableCsrfValidation]] is true, CSRF validation by token will used.
|
||||||
@@ -1897,7 +1897,7 @@ class Request extends \yii\base\Request
|
|||||||
$method = $this->getMethod();
|
$method = $this->getMethod();
|
||||||
|
|
||||||
if ($this->validateCsrfHeaderOnly) {
|
if ($this->validateCsrfHeaderOnly) {
|
||||||
return in_array($method, $this->csrfHeaderUnafeMethods, true)
|
return in_array($method, $this->csrfHeaderUnsafeMethods, true)
|
||||||
? $this->headers->has($this->csrfHeader)
|
? $this->headers->has($this->csrfHeader)
|
||||||
: true;
|
: true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class RequestTest extends TestCase
|
|||||||
$this->mockWebApplication();
|
$this->mockWebApplication();
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->csrfHeaderUnafeMethods = ['POST'];
|
$request->csrfHeaderUnsafeMethods = ['POST'];
|
||||||
$request->validateCsrfHeaderOnly = true;
|
$request->validateCsrfHeaderOnly = true;
|
||||||
$request->enableCsrfValidation = true;
|
$request->enableCsrfValidation = true;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user