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

Commit 12ab7e8

Browse files
committed
update router not found & method not allow
1 parent e819a05 commit 12ab7e8

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/RikkaTech/SwooleHttp/HttpServer.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ public function __construct(string $name = "default", string $ip = "127.0.0.1",
5454
$dispatch = $dispatcher->dispatch($request->getMethod(),$request->server["request_uri"]);
5555
switch ($dispatch[0]) {
5656
case \FastRoute\Dispatcher::NOT_FOUND:
57-
$response->end("404");
57+
$response->setStatusCode(404);
58+
$response->end("Not Found");
5859
break;
5960
case \FastRoute\Dispatcher::METHOD_NOT_ALLOWED:
60-
$allowedMethods = $dispatch[1];
61-
$response->end("405");
61+
$response->setStatusCode(405);
62+
$response->end("Allow: ".$dispatch[1][0]);
6263
break;
6364
case \FastRoute\Dispatcher::FOUND:
6465
$target = explode("@",$dispatch[1]);

0 commit comments

Comments
 (0)