forked from roadrunner-php/http
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEndOfStreamAwareHttpWorkerInterface.php
More file actions
25 lines (22 loc) · 1.04 KB
/
EndOfStreamAwareHttpWorkerInterface.php
File metadata and controls
25 lines (22 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
declare(strict_types=1);
namespace Spiral\RoadRunner\Http;
/**
* @psalm-import-type HeadersList from Request
*/
interface EndOfStreamAwareHttpWorkerInterface extends HttpWorkerInterface
{
/**
* Send response to the application server.
*
* @param int $status Http status code
* @param \Generator<mixed, scalar|\Stringable, mixed, \Stringable|scalar|null>|string $body Body of response.
* If the body is a generator, then each yielded value will be sent as a separated stream chunk.
* Returned value will be sent as a last stream package.
* Note: Stream response is supported by RoadRunner since version 2023.3
* @param HeadersList|array<array-key, array<array-key, string>> $headers $headers An associative array of the
* message's headers. Each key MUST be a header name, and each value MUST be an array of strings for
* that header.
*/
public function respond(int $status, string|\Generator $body = '', array $headers = [], bool $endOfStream = true): void;
}