This commit is contained in:
2021-09-10 10:50:56 +08:00
parent f217a14f23
commit 1db221c771
5 changed files with 10 additions and 10 deletions
+3 -3
View File
@@ -173,11 +173,11 @@ trait Message
/**
* @return string
* @return StreamInterface
*/
public function getBody(): string
public function getBody(): StreamInterface
{
return $this->stream->getContents();
return $this->stream;
}
+1 -1
View File
@@ -171,7 +171,7 @@ class ServerRequest extends Request implements ServerRequestInterface
if (empty($this->parsedBody)) {
$callback = Context::getContext('with.parsed.body.callback');
$this->parsedBody = $callback($this->getBody());
$this->parsedBody = $callback($this->getBody()->getContents());
}
return $this->parsedBody;
}
+1 -1
View File
@@ -42,7 +42,7 @@ class ResponseEmitter implements Emitter
$response->header('Swoole-Version', swoole_version());
if (!($emitter instanceof DownloadInterface)) {
$response->end($emitter->getBody());
$response->end($emitter->getBody()->getContents());
} else {
$emitter->dispatch($response);
}
+3 -3
View File
@@ -17,13 +17,13 @@ class WebSocketEmitter implements Emitter
/**
* @param mixed $response
* @param ResponseInterface|\Server\Message\Response $emitter
* @param ResponseInterface|\Protocol\Message\Response $emitter
* @throws Exception
*/
public function sender(mixed $response, ResponseInterface|\Server\Message\Response $emitter): void
public function sender(mixed $response, ResponseInterface|\Protocol\Message\Response $emitter): void
{
$server = Kiri::getDi()->get(ServerManager::class)->getServer();
$server->push($response->fd, $emitter->getBody());
$server->push($response->fd, $emitter->getBody()->getContents());
}
}
+2 -2
View File
@@ -4,7 +4,7 @@ namespace Server;
use Annotation\Inject;
use Server\Constrict\Response;
use Server\Message\Stream;
use Protocol\Message\Stream;
class Sender
{
@@ -35,7 +35,7 @@ class Sender
if (!$server->isEstablished($fd)) {
return;
}
$server->push($fd, $body->getBody());
$server->push($fd, $body->getBody()->getContents());
}