Add OPTIONS endpoint

This commit is contained in:
Philipp 2022-01-02 20:25:32 +01:00
parent 1239ce1e7e
commit 01c1e137f7
No known key found for this signature in database
GPG key ID: 24A7501396EB5432
3 changed files with 35 additions and 8 deletions

View file

@ -0,0 +1,16 @@
<?php
namespace Friendica\Module\Special;
use Friendica\App\Router;
use Friendica\BaseModule;
class Options extends BaseModule
{
protected function options(array $request = [])
{
// @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS
$this->response->setHeader('Allow', implode(',', Router::ALLOWED_METHODS));
$this->response->setHeader(($this->server['SERVER_PROTOCOL'] ?? 'HTTP/1.1') . ' 204 No Content');
}
}