From 7a79dc0ca6ab11f0424b0526fd80720cf9c7bbb1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 11 Mar 2024 16:31:22 +0100 Subject: [PATCH] Add support for `DELETE` requests --- .../install/files/lib/action/ApiAction.class.php | 2 ++ .../lib/system/endpoint/DeleteRequest.class.php | 12 ++++++++++++ .../lib/system/endpoint/RequestMethod.class.php | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/endpoint/DeleteRequest.class.php diff --git a/wcfsetup/install/files/lib/action/ApiAction.class.php b/wcfsetup/install/files/lib/action/ApiAction.class.php index baf138b58d..6721ade812 100644 --- a/wcfsetup/install/files/lib/action/ApiAction.class.php +++ b/wcfsetup/install/files/lib/action/ApiAction.class.php @@ -10,6 +10,7 @@ use Laminas\Diactoros\Response\JsonResponse; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; use Psr\Http\Server\RequestHandlerInterface; +use wcf\http\attribute\AllowHttpMethod; use wcf\system\endpoint\event\ControllerCollecting; use wcf\system\endpoint\IController; use wcf\system\endpoint\RequestFailure; @@ -21,6 +22,7 @@ use wcf\system\request\RouteHandler; use function FastRoute\simpleDispatcher; +#[AllowHttpMethod('DELETE')] final class ApiAction implements RequestHandlerInterface { #[\Override] diff --git a/wcfsetup/install/files/lib/system/endpoint/DeleteRequest.class.php b/wcfsetup/install/files/lib/system/endpoint/DeleteRequest.class.php new file mode 100644 index 0000000000..6b43821461 --- /dev/null +++ b/wcfsetup/install/files/lib/system/endpoint/DeleteRequest.class.php @@ -0,0 +1,12 @@ + 'DELETE', self::GET => 'GET', self::POST => 'POST', }; -- 2.20.1