From 77408ce182928e340b688d9ad11eafeb637760bc Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Mon, 3 Aug 2026 08:34:58 +0300 Subject: [PATCH] Fix CORS preflight response missing headers Ensure Access-Control-Allow-Origin is sent during preflight requests to resolve browser blocking issues. Closes #8 --- src/Filters/CorsFilter.php | 2 +- src/ServiceCors.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Filters/CorsFilter.php b/src/Filters/CorsFilter.php index a1dbe33..061b7b2 100644 --- a/src/Filters/CorsFilter.php +++ b/src/Filters/CorsFilter.php @@ -44,7 +44,7 @@ public function before(RequestInterface $request, $arguments = null) */ public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) { - if ($request->getMethod(true) === 'OPTIONS') { + if ($request->getMethod() === 'OPTIONS') { $response = $this->cors->varyHeader($response, 'Access-Control-Request-Method'); } diff --git a/src/ServiceCors.php b/src/ServiceCors.php index 320f6f0..611459e 100644 --- a/src/ServiceCors.php +++ b/src/ServiceCors.php @@ -106,7 +106,7 @@ public function isCorsRequest(RequestInterface $request): bool public function isPreflightRequest(RequestInterface $request): bool { - return $request->getMethod(true) === 'OPTIONS' && $request->hasHeader('Access-Control-Request-Method'); + return $request->getMethod() === 'OPTIONS' && $request->hasHeader('Access-Control-Request-Method'); } public function handlePreflightRequest(RequestInterface $request): ResponseInterface