diff options
author | Valery Piashchynski <[email protected]> | 2020-11-18 18:15:09 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-11-18 18:15:09 +0300 |
commit | 8fab090abc369237d5f9be2ee676005b24c2a470 (patch) | |
tree | 9f7fc358b66357f0218b8256d8073616995b91db /plugins/http/tests/psr-worker.php | |
parent | 4ccd58fc363264d24f642ab7e0ccfe6538a0b91c (diff) |
Handler test
Diffstat (limited to 'plugins/http/tests/psr-worker.php')
-rw-r--r-- | plugins/http/tests/psr-worker.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/plugins/http/tests/psr-worker.php b/plugins/http/tests/psr-worker.php new file mode 100644 index 00000000..65fc6bde --- /dev/null +++ b/plugins/http/tests/psr-worker.php @@ -0,0 +1,23 @@ +<?php +/** + * @var Goridge\RelayInterface $relay + */ +use Spiral\Goridge; +use Spiral\RoadRunner; + +ini_set('display_errors', 'stderr'); +require dirname(__DIR__) . "/../../vendor_php/autoload.php"; + +$worker = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT)); +$psr7 = new RoadRunner\PSR7Client($worker); + +while ($req = $psr7->acceptRequest()) { + try { + $resp = new \Zend\Diactoros\Response(); + $resp->getBody()->write("hello world"); + + $psr7->respond($resp); + } catch (\Throwable $e) { + $psr7->getWorker()->error((string)$e); + } +}
\ No newline at end of file |