diff --git a/CHANGELOG.md b/CHANGELOG.md index 736e287..23dac68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file. Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles. ## [Unreleased][unreleased] +#### Changed +* [BC] DefaultHandler response code 404 instead 400 #### Added * CorsPreflightHandlerInterface - resolve multiple service registered handler error diff --git a/src/Handlers/DefaultHandler.php b/src/Handlers/DefaultHandler.php index 11ef4d6..598881e 100644 --- a/src/Handlers/DefaultHandler.php +++ b/src/Handlers/DefaultHandler.php @@ -15,6 +15,6 @@ class DefaultHandler extends BaseHandler */ public function handle(array $params): ResponseInterface { - return new JsonApiResponse(IResponse::S400_BAD_REQUEST, ['status' => 'error', 'message' => 'Unknown api endpoint']); + return new JsonApiResponse(IResponse::S404_NOT_FOUND, ['status' => 'error', 'message' => 'Unknown api endpoint']); } } diff --git a/tests/Handler/DefaultHandlerTest.php b/tests/Handler/DefaultHandlerTest.php index 13abd66..e67f8f6 100644 --- a/tests/Handler/DefaultHandlerTest.php +++ b/tests/Handler/DefaultHandlerTest.php @@ -18,7 +18,7 @@ public function testResponse() { $defaultHandler = new DefaultHandler(); $result = $defaultHandler->handle([]); - $this->assertEquals(400, $result->getCode()); + $this->assertEquals(404, $result->getCode()); $this->assertEquals('application/json', $result->getContentType()); $this->assertEquals('utf-8', $result->getCharset()); $this->assertEquals(['status' => 'error', 'message' => 'Unknown api endpoint'], $result->getPayload());