Adjusted CORS handling for emoticon endpoint.
This commit is contained in:
parent
f0fc735975
commit
77eadd5bde
1 changed files with 6 additions and 1 deletions
|
@ -37,10 +37,15 @@ final class SharpChatRoutes implements IRouteHandler {
|
||||||
Route::handleAttributes($router, $this);
|
Route::handleAttributes($router, $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Route('OPTIONS', '/_sockchat/emotes')]
|
||||||
#[Route('GET', '/_sockchat/emotes')]
|
#[Route('GET', '/_sockchat/emotes')]
|
||||||
public function getEmotes($response, $request): array {
|
public function getEmotes($response, $request): array|int {
|
||||||
$response->setHeader('Access-Control-Allow-Origin', '*');
|
$response->setHeader('Access-Control-Allow-Origin', '*');
|
||||||
$response->setHeader('Access-Control-Allow-Methods', 'GET');
|
$response->setHeader('Access-Control-Allow-Methods', 'GET');
|
||||||
|
$response->setHeader('Access-Control-Allow-Headers', 'Cache-Control');
|
||||||
|
|
||||||
|
if($request->getMethod() === 'OPTIONS')
|
||||||
|
return 204;
|
||||||
|
|
||||||
$emotes = $this->emotes->getEmotes(orderBy: 'order');
|
$emotes = $this->emotes->getEmotes(orderBy: 'order');
|
||||||
$out = [];
|
$out = [];
|
||||||
|
|
Loading…
Reference in a new issue