qqq
This commit is contained in:
+13
-4
@@ -4,6 +4,11 @@ declare(strict_types=1);
|
|||||||
namespace Kiri\Router;
|
namespace Kiri\Router;
|
||||||
|
|
||||||
|
|
||||||
|
use Kiri\Server\Events\OnAfterRequest;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -13,10 +18,13 @@ class StreamResponse extends Response
|
|||||||
public int $limit;
|
public int $limit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param object $response
|
* @param object $response
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
public function end(object $response): void
|
public function end(object $response): void
|
||||||
{
|
{
|
||||||
$body = $this->getBody();
|
$body = $this->getBody();
|
||||||
@@ -28,6 +36,7 @@ class StreamResponse extends Response
|
|||||||
$response->write($body->read($this->limit));
|
$response->write($body->read($this->limit));
|
||||||
}
|
}
|
||||||
$response->end();
|
$response->end();
|
||||||
|
event(new OnAfterRequest());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,26 +5,34 @@ namespace Kiri\Router;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use Kiri\Di\Interface\ResponseEmitterInterface;
|
use Kiri\Di\Interface\ResponseEmitterInterface;
|
||||||
|
use Kiri\Server\Events\OnAfterRequest;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
|
|
||||||
class SwooleHttpResponseEmitter implements ResponseEmitterInterface
|
class SwooleHttpResponseEmitter implements ResponseEmitterInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Response $proxy
|
* @param Response $proxy
|
||||||
* @param object $response
|
* @param object $response
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws ContainerExceptionInterface
|
||||||
*/
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
public function sender(ResponseInterface $proxy, object $response): void
|
public function sender(ResponseInterface $proxy, object $response): void
|
||||||
{
|
{
|
||||||
// TODO: Implement sender() method.
|
// TODO: Implement sender() method.
|
||||||
$this->writeParams($proxy, $response);
|
$this->writeParams($proxy, $response);
|
||||||
|
|
||||||
$proxy->end($response);
|
$proxy->end($response);
|
||||||
}
|
|
||||||
|
event(new OnAfterRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,22 +3,31 @@
|
|||||||
namespace Kiri\Router;
|
namespace Kiri\Router;
|
||||||
|
|
||||||
use Kiri\Di\Interface\ResponseEmitterInterface;
|
use Kiri\Di\Interface\ResponseEmitterInterface;
|
||||||
|
use Kiri\Server\Events\OnAfterRequest;
|
||||||
|
use Psr\Container\ContainerExceptionInterface;
|
||||||
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use ReflectionException;
|
||||||
|
|
||||||
class SwowHttpResponseEmitter implements ResponseEmitterInterface
|
class SwowHttpResponseEmitter implements ResponseEmitterInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Response $proxy
|
* @param Response $proxy
|
||||||
* @param object $response
|
* @param object $response
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
* @throws ContainerExceptionInterface
|
||||||
|
* @throws NotFoundExceptionInterface
|
||||||
|
* @throws ReflectionException
|
||||||
|
*/
|
||||||
public function sender(ResponseInterface $proxy, object $response): void
|
public function sender(ResponseInterface $proxy, object $response): void
|
||||||
{
|
{
|
||||||
// TODO: Implement sender() method.
|
// TODO: Implement sender() method.
|
||||||
$proxy->withHeader('Server', 'Swow');
|
$proxy->withHeader('Server', 'Swow');
|
||||||
$response->sendHttpResponse($proxy);
|
$response->sendHttpResponse($proxy);
|
||||||
}
|
|
||||||
|
event(new OnAfterRequest());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user