diff --git a/HttpServer/Http/Context.php b/HttpServer/Http/Context.php index 555c94a7..19ae572f 100644 --- a/HttpServer/Http/Context.php +++ b/HttpServer/Http/Context.php @@ -64,16 +64,16 @@ class Context extends BaseContext if (!static::hasContext($id)) { Coroutine::getContext()[$id] = []; } - if (empty($key)) { - return Coroutine::getContext()[$id] = $context; - } - $oldData = Coroutine::getContext()[$id]; - if (!is_array($oldData)) { - $oldData = [$key => $context]; + if (!empty($key)) { + if (!is_array(Coroutine::getContext()[$id])) { + Coroutine::getContext()[$id] = [$key => $context]; + } else { + Coroutine::getContext()[$id][$key] = $context; + } } else { - $oldData[$key] = $context; + Coroutine::getContext()[$id] = $context; } - return Coroutine::getContext()[$id] = $oldData; + return $context; } /** diff --git a/HttpServer/Http/Request.php b/HttpServer/Http/Request.php index 4dbd43ea..d0c7cc32 100644 --- a/HttpServer/Http/Request.php +++ b/HttpServer/Http/Request.php @@ -403,7 +403,6 @@ class Request extends Application } /** - * @param $router * @return bool */ public function isNotFound()