Skip to content

Commit b4f7537

Browse files
committed
minor #12355 Mentioned the toStream() method (javiereguiluz)
This PR was submitted for the 4.4 branch but it was merged into the 4.3 branch instead (closes #12355). Discussion ---------- Mentioned the toStream() method Fixes #11910. Commits ------- 1c1c590 Mentioned the toStream() method
2 parents fb26f4f + 1c1c590 commit b4f7537

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

components/http_client.rst

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ following methods::
330330
// gets the response body as a string
331331
$content = $response->getContent();
332332

333+
// casts the response JSON contents to a PHP array
334+
$content = $response->toArray();
335+
336+
// casts the response content to a PHP stream resource
337+
$content = $response->toStream();
338+
333339
// cancels the request/response
334340
$response->cancel();
335341

@@ -339,16 +345,19 @@ following methods::
339345
// you can get individual info too
340346
$startTime = $response->getInfo('start_time');
341347

348+
// returns detailed logs about the requests and responses of the HTTP transaction
349+
$httpLogs = $response->getInfo('debug');
350+
351+
.. versionadded:: 4.4
352+
353+
The ``toStream()`` method was introduced in Symfony 4.4.
354+
342355
.. note::
343356

344357
``$response->getInfo()`` is non-blocking: it returns *live* information
345358
about the response. Some of them might not be known yet (e.g. ``http_code``)
346359
when you'll call it.
347360

348-
.. tip::
349-
350-
Call ``$response->getInfo('debug')`` to get detailed logs about the HTTP transaction.
351-
352361
.. _http-client-streaming-responses:
353362

354363
Streaming Responses

0 commit comments

Comments
 (0)