This commit is contained in:
2025-04-25 20:59:13 -04:00
parent e84c7cf9ad
commit 60b758e995
14 changed files with 795 additions and 34 deletions

View File

@@ -13,7 +13,6 @@ use Nyholm\Psr7\Response;
*/
class JsonResponseFactory
{
/**
* Create a JSON response with the given data and status code.
*
@@ -32,4 +31,4 @@ class JsonResponseFactory
body: json_encode($data, JSON_THROW_ON_ERROR)
);
}
}
}

View File

@@ -31,10 +31,12 @@ class CorsMiddleware implements MiddlewareInterface
{
$origin = $request->getHeaderLine('Origin');
$allowedOrigins = array_map(
'trim', explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
));
'trim',
explode(
',',
Config::get('CORS_ALLOWED_ORIGINS', 'https://example.com,https://another.com')
)
);
$allowOrigin = in_array($origin, $allowedOrigins, true)
? $origin
@@ -63,4 +65,4 @@ class CorsMiddleware implements MiddlewareInterface
return $response->withHeader('Access-Control-Max-Age', $maxAge);
}
}
}