From 8af8c5395946af5f822dd5d393f2f3f16ce39b05 Mon Sep 17 00:00:00 2001 From: Pierre Clavequin Date: Wed, 30 Apr 2025 18:45:03 +0800 Subject: [PATCH] fix: can send Json even if Flight is not started yet --- flight/Engine.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flight/Engine.php b/flight/Engine.php index 6c59ff5..4c88179 100644 --- a/flight/Engine.php +++ b/flight/Engine.php @@ -913,7 +913,11 @@ class Engine ->status($code) ->header('Content-Type', 'application/json') ->write($json); - if ($this->response()->v2_output_buffering === true) { + + if ( + $this->response()->v2_output_buffering === true + || ($this->requestHandled === false && empty(getenv('PHPUNIT_TEST'))) + ) { $this->response()->send(); } }