File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,12 @@ following methods::
330
330
// gets the response body as a string
331
331
$content = $response->getContent();
332
332
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
+
333
339
// cancels the request/response
334
340
$response->cancel();
335
341
@@ -339,16 +345,19 @@ following methods::
339
345
// you can get individual info too
340
346
$startTime = $response->getInfo('start_time');
341
347
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
+
342
355
.. note ::
343
356
344
357
``$response->getInfo() `` is non-blocking: it returns *live * information
345
358
about the response. Some of them might not be known yet (e.g. ``http_code ``)
346
359
when you'll call it.
347
360
348
- .. tip ::
349
-
350
- Call ``$response->getInfo('debug') `` to get detailed logs about the HTTP transaction.
351
-
352
361
.. _http-client-streaming-responses :
353
362
354
363
Streaming Responses
You can’t perform that action at this time.
0 commit comments