From 97642e770b0260bc5d7e067e40e818ccdeff6141 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 7 Jan 2023 22:47:52 -0500 Subject: [PATCH] Treat unsupported API call as HTTP error --- src/Module/Api/ApiResponse.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Module/Api/ApiResponse.php b/src/Module/Api/ApiResponse.php index 2d54bc176..b5b2a4717 100644 --- a/src/Module/Api/ApiResponse.php +++ b/src/Module/Api/ApiResponse.php @@ -276,9 +276,8 @@ class ApiResponse extends Response 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '', 'request' => $request, ]); - $error = $this->l10n->t('API endpoint %s %s is not implemented', strtoupper($method), $path); - $error_description = $this->l10n->t('The API endpoint is currently not implemented but might be in the future.'); + $error = $this->l10n->t('API endpoint %s %s is not implemented but might be in the future.', strtoupper($method), $path); - $this->exit('error', ['error' => ['error' => $error, 'error_description' => $error_description]]); + $this->error(501, 'Not Implemented', $error); } }