Skip to content

Commit 5a0fa26

Browse files
fix process method add RequestHandlerInterface $handler argment
1 parent 71ad8a4 commit 5a0fa26

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/Middlewares/CorsMiddleware.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Effectra\Core\Application;
99
use Psr\Http\Message\ResponseInterface;
1010
use Psr\Http\Message\ServerRequestInterface;
11+
use Psr\Http\Server\RequestHandlerInterface;
1112

1213
/**
1314
* The Cors class handles CORS (Cross-Origin Resource Sharing) headers for HTTP requests.
@@ -32,12 +33,14 @@ private static function getConfig(): array
3233
* Process the CORS headers for the given request and response.
3334
*
3435
* @param ServerRequestInterface $request The HTTP request.
35-
* @param ResponseInterface $response The HTTP response.
36+
* @param RequestHandlerInterface $handler The HTTP request handler.
3637
*
3738
* @return ResponseInterface The updated HTTP response with CORS headers.
3839
*/
39-
public static function process(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
40+
public static function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
4041
{
42+
$response = $handler->handle($request);
43+
4144
$cors = static::getConfig();
4245
$origin = $request->getHeaderLine('Origin');
4346
$headers = $request->getHeaderLine('Access-Control-Request-Headers');

0 commit comments

Comments
 (0)