Skip to content

Commit

Permalink
fix 'unafe' typo
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbaturin committed Nov 28, 2024
1 parent 9d1a797 commit 36b34b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions framework/web/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Request extends \yii\base\Request
* This property is used only when both [[enableCsrfValidation]] and [[validateCsrfHeaderOnly]] are true.
* @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.
* If false and [[enableCsrfValidation]] is true, CSRF validation by token will used.
Expand Down Expand Up @@ -1897,7 +1897,7 @@ public function validateCsrfToken($clientSuppliedToken = null)
$method = $this->getMethod();

if ($this->validateCsrfHeaderOnly) {
return in_array($method, $this->csrfHeaderUnafeMethods, true)
return in_array($method, $this->csrfHeaderUnsafeMethods, true)
? $this->headers->has($this->csrfHeader)
: true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/framework/web/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public function testCustomUnsafeMethodsCsrfHeaderValidation()
$this->mockWebApplication();

$request = new Request();
$request->csrfHeaderUnafeMethods = ['POST'];
$request->csrfHeaderUnsafeMethods = ['POST'];
$request->validateCsrfHeaderOnly = true;
$request->enableCsrfValidation = true;

Expand Down

0 comments on commit 36b34b0

Please sign in to comment.