This commit is contained in:
2023-11-03 17:44:38 +08:00
parent 115d228158
commit 1582c0c241
4 changed files with 38 additions and 7 deletions
+9 -2
View File
@@ -2,6 +2,7 @@
namespace Kiri\Router\Format;
use Kiri\Di\Inject\Container;
use Kiri\Router\Constrict\Stream;
use Psr\Http\Message\ResponseInterface;
@@ -9,14 +10,20 @@ class ArrayFormat implements IFormat
{
/**
* @var ResponseInterface
*/
#[Container(ResponseInterface::class)]
public ResponseInterface $response;
/**
* @param $result
* @return ResponseInterface
*/
public function call($result): ResponseInterface
{
$result = json_encode($result, JSON_UNESCAPED_UNICODE);
return \response()->withBody(new Stream($result));
return $this->response->withBody(new Stream(json_encode($result, JSON_UNESCAPED_UNICODE)));
}