Skip to content

Commit

Permalink
fix: allowedHeaders check
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Apr 9, 2020
1 parent 6932d22 commit 4b8014f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/CorsCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

use think\Request;
use think\Response;
use function HZEX\Think\Cors\str_starts_with;

class CorsCore
{
Expand Down Expand Up @@ -286,7 +285,7 @@ public function checkPreflightRequestConditions(Request $request): ?Response
return $this->createBadRequestResponse(405, 'Method not allowed');
}

if ($this->allowedHeaders && $headers = $request->header('Access-Control-Request-Headers')) {
if ($this->allowedHeaders !== true && $headers = $request->header('Access-Control-Request-Headers')) {
$headers = array_filter(explode(',', strtolower($headers)));

foreach ($headers as $header) {
Expand Down

0 comments on commit 4b8014f

Please sign in to comment.