drain example

$options['on_headers']($response);
            } catch (\Exception $e) {
                return P\Create::rejectionFor(
                    new RequestException('An error was encountered during the on_headers event', $request$response$e)
                );
            }
        }

        // Do not drain when the request is a HEAD request because they have         // no body.         if ($sink !== $stream) {
            $this->drain($stream$sink$response->getHeaderLine('Content-Length'));
        }

        $this->invokeStats($options$request$startTime$response, null);

        return new FulfilledPromise($response);
    }

    private function createSink(StreamInterface $stream, array $options): StreamInterface
    {
        if (!empty($options['stream'])) {
            return $stream;
        }
Home | Imprint | This part of the site doesn't use cookies.