docs: add doc comments

This commit is contained in:
kenjis 2024-03-25 10:05:02 +09:00
parent 029db62824
commit 2664c06335
No known key found for this signature in database
GPG Key ID: BD254878922AF198

View File

@ -74,12 +74,18 @@ class Cors
return new self($config);
}
/**
* Whether if the request is a preflight request.
*/
public function isPreflightRequest(IncomingRequest $request): bool
{
return $request->is('OPTIONS')
&& $request->hasHeader('Access-Control-Request-Method');
}
/**
* Handles the preflight request, and returns the response.
*/
public function handlePreflightRequest(RequestInterface $request, ResponseInterface $response): ResponseInterface
{
$response->setStatusCode(204);
@ -197,6 +203,9 @@ class Cors
}
}
/**
* Adds CORS headers to the Response.
*/
public function addResponseHeaders(RequestInterface $request, ResponseInterface $response): ResponseInterface
{
$this->setAllowOrigin($request, $response);