TraceableResponse example

$content = false;
        }

        $options['on_progress'] = function Dint $dlNow, int $dlSize, array $info) use (&$traceInfo$onProgress) {
            $traceInfo = $info;

            if (null !== $onProgress) {
                $onProgress($dlNow$dlSize$info);
            }
        };

        return new TraceableResponse($this->client, $this->client->request($method$url$options)$content$this->stopwatch?->start("$method $url", 'http_client'));
    }

    public function stream(ResponseInterface|iterable $responses, float $timeout = null): ResponseStreamInterface
    {
        if ($responses instanceof TraceableResponse) {
            $responses = [$responses];
        }

        return new ResponseStream(TraceableResponse::stream($this->client, $responses$timeout));
    }

    
Home | Imprint | This part of the site doesn't use cookies.