Skip to content

[HttpClient] Document pre-conditions for HttpClient asynchronous behavior #13078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions components/http_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ immediately instead of waiting to receive the response::
This component also supports :ref:`streaming responses <http-client-streaming-responses>`
for full asynchronous applications.

.. caution::
Copy link
Member

@nicolas-grekas nicolas-grekas Feb 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is too early and too scary in the page :)
I would try to make the description more... descriptive.
We feel the stress when reading it, but there is nothing special here, this is normal operations. It needs to be better described of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree for the scary thing :D

Where do you think it would fit the best in the doc?
IMHO it should be mentioned ASAP.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about adding a Troubleshooting headline + a subsection and mentioning not just the solution but also the WHY you came to this point?


Reference to ``$response`` object must be kept in order to benefit from the asynchronous
behavior. If not, the response object is destroyed by PHP
garbage collector which forces the response to be resolved at this moment.
One solution is to store all ``$response`` object in an ``array`` to keep a reference to them
until they are not needed anymore.

.. note::

HTTP compression and chunked transfer encoding are automatically enabled when
Expand Down