diff --git a/function.php b/function.php index d11166c6..4ae31d06 100644 --- a/function.php +++ b/function.php @@ -4,6 +4,7 @@ defined('APP_PATH') or define('APP_PATH', realpath(__DIR__ . '/../../')); use Annotation\Annotation; +use HttpServer\Http\Context; use HttpServer\Http\HttpParams; use HttpServer\Http\Request; use HttpServer\Http\Response; @@ -613,7 +614,11 @@ if (!function_exists('response')) { */ function response(): Response|stdClass { - return Snowflake::getApp('response'); + $response = Context::getContext('response'); + if (empty($response)){ + $response = Snowflake::getApp('response'); + } + return $response; } }