From 29ac9a2e9293cbcb59183bf66d427d6e00c8316f Mon Sep 17 00:00:00 2001 From: Juris Skesters Date: Mon, 16 Nov 2020 09:55:09 +0200 Subject: [PATCH] =?UTF-8?q?Fixes=20#3=20An=20error=20occurred=20creating?= =?UTF-8?q?=20the=20expectation=20"Syntax=20error"=20on=20Respo=E2=80=A6?= =?UTF-8?q?=20(#4)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * #3 An error occurred creating the expectation "Syntax error" on Respond with large Body * #3 An error occurred creating the expectation "Syntax error" on Respond with large Body - Fixed tests --- src/Http/Implementation/ReactPhpServer.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Http/Implementation/ReactPhpServer.php b/src/Http/Implementation/ReactPhpServer.php index 7432f13..995875e 100644 --- a/src/Http/Implementation/ReactPhpServer.php +++ b/src/Http/Implementation/ReactPhpServer.php @@ -29,6 +29,9 @@ use Psr\Log\LoggerInterface; use React\EventLoop\Factory as EventLoop; use React\EventLoop\LoopInterface; +use React\Http\Middleware\RequestBodyBufferMiddleware; +use React\Http\Middleware\RequestBodyParserMiddleware; +use React\Http\Middleware\StreamingRequestMiddleware; use React\Http\Server; use React\Socket\Server as ReactSocket; @@ -60,6 +63,9 @@ public function listen(HostInterface $host, Port $port, ?SecureOptions $secureOp { $this->http = new Server( $this->loop, + new StreamingRequestMiddleware(), + new RequestBodyBufferMiddleware(), + new RequestBodyParserMiddleware(), function (ServerRequestInterface $request) { return $this->onRequest($request); } @@ -70,7 +76,7 @@ function (ServerRequestInterface $request) { $this->http->listen($this->socket); // Dispatch pending signals periodically - if (function_exists('pcntl_signal_dispatch')) { + if (\function_exists('pcntl_signal_dispatch')) { $this->loop->addPeriodicTimer(0.5, function () { pcntl_signal_dispatch(); });