diff --git a/src/yoyo/Services/Response.php b/src/yoyo/Services/Response.php index 8ff75d1..a6ac830 100644 --- a/src/yoyo/Services/Response.php +++ b/src/yoyo/Services/Response.php @@ -41,12 +41,10 @@ public function send(string $content = ''): string header("$key: $value"); } - if ($this->statusCode == 204) { - http_response_code(204); + if (! headers_sent()) { + http_response_code($this->statusCode ?? 200); } - http_response_code($this->statusCode ?? 200); - return $content ?: ''; }