Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
update router not found & method not allow
Browse files Browse the repository at this point in the history
  • Loading branch information
lixworth committed Aug 30, 2021
1 parent e819a05 commit 12ab7e8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/RikkaTech/SwooleHttp/HttpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,12 @@ public function __construct(string $name = "default", string $ip = "127.0.0.1",
$dispatch = $dispatcher->dispatch($request->getMethod(),$request->server["request_uri"]);
switch ($dispatch[0]) {
case \FastRoute\Dispatcher::NOT_FOUND:
$response->end("404");
$response->setStatusCode(404);
$response->end("Not Found");
break;
case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
$allowedMethods = $dispatch[1];
$response->end("405");
$response->setStatusCode(405);
$response->end("Allow: ".$dispatch[1][0]);
break;
case \FastRoute\Dispatcher::FOUND:
$target = explode("@",$dispatch[1]);
Expand Down

0 comments on commit 12ab7e8

Please sign in to comment.