This commit is contained in:
2021-09-07 16:14:44 +08:00
parent 968814bd57
commit e412f0681f
7 changed files with 144 additions and 84 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ namespace Server\Constrict;
use Annotation\Inject;
use Psr\Http\Message\ResponseInterface;
use Server\RequestInterface;
use Server\SInterface\DownloadInterface;
use Swoole\Server;
@@ -41,7 +42,12 @@ class ResponseEmitter implements Emitter
$response->setStatusCode($emitter->getStatusCode());
$response->header('Server', 'swoole');
$response->header('Swoole-Version', swoole_version());
$response->end($emitter->getBody());
if (!($emitter instanceof DownloadInterface)) {
$response->end($emitter->getBody());
} else {
$emitter->dispatch($response);
}
}
}