Skip to content

Commit

Permalink
fix: Handle correctly invalid HTTP method errors
Browse files Browse the repository at this point in the history
  • Loading branch information
marienfressinaud committed Dec 1, 2024
1 parent 0efb5bd commit 7ea7cd5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
include $app_path . '/vendor/autoload.php';
\App\Configuration::load('dotenv', $app_path);

// Get the http information and create a Request
$request = \Minz\Request::initFromGlobals();

// Initialize the Application and execute the request to get a Response
try {
$application = new \App\Application();

$request = \Minz\Request::initFromGlobals();

$response = $application->run($request);
} catch (\Minz\Errors\RequestError $e) {
$response = \Minz\Response::notFound('not_found.phtml', [
'error' => $e,
]);
} catch (\Exception $e) {
$response = \Minz\Response::internalServerError('internal_server_error.phtml', [
'environment' => \App\Configuration::$environment,
'error' => $e,
]);
}
Expand Down

0 comments on commit 7ea7cd5

Please sign in to comment.