static test

This commit is contained in:
2025-04-25 21:27:31 -04:00
parent 025bc2d924
commit ac99a78bdf
9 changed files with 103 additions and 14 deletions

View File

@@ -16,7 +16,7 @@ class JsonResponseFactory
/**
* Create a JSON response with the given data and status code.
*
* @param mixed $data The data to include in the response.
* @param array $data The data to include in the response.
* @param int $statusCode The HTTP status code for the response.
* @return Response The JSON response.
* @throws \JsonException

View File

@@ -34,7 +34,7 @@ class CorsMiddleware implements MiddlewareInterface
'trim',
explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
Config::get('cors.allowed_origins')
)
);
@@ -57,11 +57,11 @@ class CorsMiddleware implements MiddlewareInterface
?: 'Content-Type, Authorization'
);
if (Config::get('CORS_ALLOW_CREDENTIALS', 'bool')) {
if (Config::get('cors.allow_credentials') === true) {
$response = $response->withHeader('Access-Control-Allow-Credentials', 'true');
}
$maxAge = Config::get('CORS_MAX_AGE') ?: '86400';
$maxAge = Config::get('CORS_MAX_AGE') !== 3600 ? Config::get('CORS_MAX_AGE') : 3600;
return $response->withHeader('Access-Control-Max-Age', $maxAge);
}