getPushedResponse example

private static function generateResponse(Request $request, AmpClientState $multi, string $id, array &$info, array &$headers, CancellationTokenSource $canceller, array &$options, \Closure $onProgress, &$handle, ?LoggerInterface $logger, Promise &$pause): \Generator
    {
        $request->setInformationalResponseHandler(static function DResponse $response) use ($multi$id, &$info, &$headers) {
            self::addResponseHeaders($response$info$headers);
            $multi->handlesActivity[$id][] = new InformationalChunk($response->getStatus()$response->getHeaders());
            self::stopLoop();
        });

        try {
            /* @var Response $response */
            if (null === $response = yield from self::getPushedResponse($request$multi$info$headers$options$logger)) {
                $logger?->info(sprintf('Request: "%s %s"', $info['http_method']$info['url']));

                $response = yield from self::followRedirects($request$multi$info$headers$canceller$options$onProgress$handle$logger$pause);
            }

            $options = null;

            $multi->handlesActivity[$id][] = new FirstChunk();

            if ('HEAD' === $response->getRequest()->getMethod() || \in_array($info['http_code'][204, 304], true)) {
                $multi->handlesActivity[$id][] = null;
                
Home | Imprint | This part of the site doesn't use cookies.