Skip to content

Commit

Permalink
Merge branch '4.0' into matyus/semantic-versions
Browse files Browse the repository at this point in the history
  • Loading branch information
romanmatyus authored Apr 19, 2024
2 parents 7c8f389 + 97718ff commit abb3062
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip
## [Unreleased][unreleased]
#### Changed
* [BC] Support for semantic versioning api. Need retype version from `int` to `string`.
* [BC] DefaultHandler response code 404 instead 400

#### Added
* CorsPreflightHandlerInterface - resolve multiple service registered handler error
Expand Down
2 changes: 1 addition & 1 deletion src/Handlers/DefaultHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}
2 changes: 1 addition & 1 deletion tests/Handler/DefaultHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit abb3062

Please sign in to comment.