Skip to content

Commit

Permalink
fix process method add RequestHandlerInterface $handler argment
Browse files Browse the repository at this point in the history
  • Loading branch information
BMTmohammedtaha committed Oct 14, 2023
1 parent 71ad8a4 commit 5a0fa26
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Middlewares/CorsMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Effectra\Core\Application;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

/**
* The Cors class handles CORS (Cross-Origin Resource Sharing) headers for HTTP requests.
Expand All @@ -32,12 +33,14 @@ private static function getConfig(): array
* Process the CORS headers for the given request and response.
*
* @param ServerRequestInterface $request The HTTP request.
* @param ResponseInterface $response The HTTP response.
* @param RequestHandlerInterface $handler The HTTP request handler.
*
* @return ResponseInterface The updated HTTP response with CORS headers.
*/
public static function process(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
public static function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $handler->handle($request);

$cors = static::getConfig();
$origin = $request->getHeaderLine('Origin');
$headers = $request->getHeaderLine('Access-Control-Request-Headers');
Expand Down

0 comments on commit 5a0fa26

Please sign in to comment.