Pending Response API
withRequest() returns PendingHttpResponse.
$pending->get()returnsHttpResponsefor the request mode$pending->statusCode()reads status quickly$pending->headers()reads response headers$pending->content()reads body text (non-streamed mode)$pending->stream()yields streamed chunks
Sync vs Stream Contract
PendingHttpResponse keeps sync and stream executions separate.
get()follows request mode (withStreaming(false|true))content()uses non-streamed executionstream()uses streamed execution- If you use both paths, they execute independently and cache per mode
Working with HttpResponse
stream().
Exceptions
WithfailOnError: true, expect typed exceptions (e.g. timeout, connection, HTTP status exceptions). Let them bubble unless you have explicit recovery logic.