From e895d3b1eb348f1be1c8e926311a7e61b2ef024d Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 11 Nov 2020 20:28:36 +0000 Subject: [PATCH 1/2] API: Not implemented stuff should return 404 --- include/api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/api.php b/include/api.php index 09184dcf9..87ce982b0 100644 --- a/include/api.php +++ b/include/api.php @@ -386,7 +386,7 @@ function api_call(App $a, App\Arguments $args = null) } Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call', 'query' => DI::args()->getQueryString()]); - throw new NotImplementedException(); + throw new NotFoundException(); } catch (HTTPException $e) { header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}"); return api_error($type, $e, $args); From 5598f7d6ba9f1580efe194505fead3d42747ccf2 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 11 Nov 2020 20:49:34 +0000 Subject: [PATCH 2/2] Fix test --- tests/legacy/ApiTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/legacy/ApiTest.php b/tests/legacy/ApiTest.php index 9f7aff7a0..4fd6855f2 100644 --- a/tests/legacy/ApiTest.php +++ b/tests/legacy/ApiTest.php @@ -500,7 +500,7 @@ class ApiTest extends FixtureTest public function testApiCallWithUninplementedApi() { self::assertEquals( - '{"status":{"error":"Not Implemented","code":"501 Not Implemented","request":""}}', + '{"status":{"error":"Not Found","code":"404 Not Found","request":""}}', api_call($this->app) ); }