This commit is contained in:
xl
2023-11-22 10:19:33 +08:00
parent 3bf66cefe2
commit e0e5455576
2 changed files with 33 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
<?php
namespace Kiri\Router\Format;
use Kiri\Router\Constrict\Stream;
use Psr\Http\Message\ResponseInterface;
class NoBody implements IFormat
{
/**
* @param $result
* @return ResponseInterface
*/
public function call($result): ResponseInterface
{
// TODO: Implement call() method.
if ($result instanceof ResponseInterface) {
$result->getBody()->write('');
} else {
$result = response()->withBody(new Stream());
}
return $result;
}
}