改名
This commit is contained in:
@@ -44,12 +44,13 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
|
|||||||
try {
|
try {
|
||||||
$request = \Server\Constrict\Request::create($request);
|
$request = \Server\Constrict\Request::create($request);
|
||||||
$node = $this->router->Branch_search($request);
|
$node = $this->router->Branch_search($request);
|
||||||
if (!($node instanceof Node)) {
|
// if (!($node instanceof Node)) {
|
||||||
throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
|
// throw new RequestException('<h2>HTTP 404 Not Found</h2><hr><i>Powered by Swoole</i>', 404);
|
||||||
}
|
// }
|
||||||
if (!(($responseData = $node->dispatch($request)) instanceof ResponseInterface)) {
|
// if (!(($responseData = $node->dispatch($request)) instanceof ResponseInterface)) {
|
||||||
$responseData = $this->transferToResponse($responseData);
|
// $responseData = $this->transferToResponse($responseData);
|
||||||
}
|
// }
|
||||||
|
$responseData = $this->transferToResponse('hello word.');
|
||||||
} catch (Error | \Throwable $exception) {
|
} catch (Error | \Throwable $exception) {
|
||||||
$responseData = $this->exceptionHandler->emit($exception, $this->response);
|
$responseData = $this->exceptionHandler->emit($exception, $this->response);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -60,11 +61,11 @@ class Http extends \Server\Abstracts\Http implements OnClose, OnConnect
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $responseData
|
* @param mixed $responseData
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function transferToResponse($responseData): ResponseInterface
|
private function transferToResponse(mixed $responseData): mixed
|
||||||
{
|
{
|
||||||
$interface = $this->response->withStatus(200);
|
$interface = $this->response->withStatus(200);
|
||||||
if (!$interface->hasContentType()) {
|
if (!$interface->hasContentType()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user