From 4fcf592f24b8c9026c7b4eb14e366ba0994aa958 Mon Sep 17 00:00:00 2001 From: roxblnfk Date: Fri, 2 Feb 2024 00:38:57 +0400 Subject: [PATCH] Actualize `Early hints` doc block --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e5a3432..80775d8 100644 --- a/README.md +++ b/README.md @@ -137,9 +137,12 @@ the `endOfStream` parameter set to `false`. This will send the response to the c additional responses. ```php -/** @var \Spiral\RoadRunner\Http\HttpWorker $httpWorker */ -$httpWorker->respond(103, header: ['Link' => ['; rel=preload; as=style']], endOfStream: false); -$httpWorker->respond(200, body: $body); +/** @var \Spiral\RoadRunner\Http\PSR7Worker $psr7 */ +$httpWorker = $psr7->getHttpWorker() + ->respond(103, header: ['Link' => ['; rel=preload; as=style']], endOfStream: false); + +// End of stream will be sent automatically after PSR7Worker::respond() call +$psr7->respond(new Response(200, [], 'Hello RoadRunner!')); ```