Merge pull request #9529 from annando/api-not-found

API: Not implemented stuff should return 404
This commit is contained in:
Hypolite Petovan 2020-11-11 16:15:24 -05:00 committed by GitHub
commit d7ea4ea425
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -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()]); Logger::warning(API_LOG_PREFIX . 'not implemented', ['module' => 'api', 'action' => 'call', 'query' => DI::args()->getQueryString()]);
throw new NotImplementedException(); throw new NotFoundException();
} catch (HTTPException $e) { } catch (HTTPException $e) {
header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}"); header("HTTP/1.1 {$e->getCode()} {$e->httpdesc}");
return api_error($type, $e, $args); return api_error($type, $e, $args);

View file

@ -500,7 +500,7 @@ class ApiTest extends FixtureTest
public function testApiCallWithUninplementedApi() public function testApiCallWithUninplementedApi()
{ {
self::assertEquals( self::assertEquals(
'{"status":{"error":"Not Implemented","code":"501 Not Implemented","request":""}}', '{"status":{"error":"Not Found","code":"404 Not Found","request":""}}',
api_call($this->app) api_call($this->app)
); );
} }