This commit is contained in:
2021-08-10 17:49:46 +08:00
parent 69a623f2a4
commit cc83805fd6
+6 -2
View File
@@ -4,7 +4,9 @@ namespace Server\Constrict;
use Exception; use Exception;
use HttpServer\Http\Formatter\FileFormatter; use HttpServer\Http\Formatter\FileFormatter;
use ReflectionException;
use Server\ResponseInterface; use Server\ResponseInterface;
use Snowflake\Exception\NotFindClassException;
/** /**
@@ -15,11 +17,13 @@ class ResponseEmitter
/** /**
* @param \Swoole\Http\Response $response * @param \Swoole\Http\Response|\Swoole\Http2\Response $response
* @param ResponseInterface $emitter * @param ResponseInterface $emitter
* @throws ReflectionException
* @throws NotFindClassException
* @throws Exception * @throws Exception
*/ */
public function sender(\Swoole\Http\Response $response, ResponseInterface $emitter) public function sender(\Swoole\Http\Response|\Swoole\Http2\Response $response, ResponseInterface $emitter)
{ {
$content = $emitter->configure($response)->getContent(); $content = $emitter->configure($response)->getContent();
if ($content instanceof FileFormatter) { if ($content instanceof FileFormatter) {