mirror of
https://github.com/shlinkio/shlink.git
synced 2025-12-10 00:10:57 -06:00
Fix issue reported by phpstan in CrossDomainMiddleware
This commit is contained in:
parent
774a579a94
commit
648696f778
@ -39,12 +39,10 @@ readonly class CrossDomainMiddleware implements MiddlewareInterface, RequestMeth
|
||||
private function addOptionsHeaders(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface
|
||||
{
|
||||
// Options requests should always be empty and have a 204 status code
|
||||
return EmptyResponse::withHeaders([
|
||||
...$response->getHeaders(),
|
||||
'Access-Control-Allow-Methods' => $this->resolveCorsAllowedMethods($response),
|
||||
'Access-Control-Allow-Headers' => $request->getHeaderLine('Access-Control-Request-Headers'),
|
||||
'Access-Control-Max-Age' => $this->options->maxAge,
|
||||
]);
|
||||
return EmptyResponse::withHeaders($response->getHeaders())
|
||||
->withHeader('Access-Control-Allow-Methods', $this->resolveCorsAllowedMethods($response))
|
||||
->withHeader('Access-Control-Allow-Headers', $request->getHeaderLine('Access-Control-Request-Headers'))
|
||||
->withHeader('Access-Control-Max-Age', (string) $this->options->maxAge);
|
||||
}
|
||||
|
||||
private function resolveCorsAllowedMethods(ResponseInterface $response): string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user