diff --git a/HttpServer/Http/Response.php b/HttpServer/Http/Response.php index e7435c6c..87a040fe 100644 --- a/HttpServer/Http/Response.php +++ b/HttpServer/Http/Response.php @@ -213,10 +213,11 @@ class Response extends HttpService if (empty($this->endData) || is_string($this->endData)) { return $this->endData; } - - $class = Response::FORMAT_MAPS[$this->format] ?? HtmlFormatter::class; - - return \di($class)->send($this->endData)->getData(); + if (!($this->endData instanceof Response)) { + $class = Response::FORMAT_MAPS[$this->format] ?? HtmlFormatter::class; + return \di($class)->send($this->endData)->getData(); + } + return $this->endData->getContent(); }