-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[HttpClient] doc how to cancel a request + upload files #11668
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
Conversation
When merging this into 4.4, don't miss removing the changes done in #11663 |
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] add $response->cancel() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11668 An alternative to #31845 and #31842. Same as #31831 but considered as a bug fix (at the Contracts level), thus for 4.3. I think we're early enough since 4.3/1.1 to do it. That will save us some headaches in the short term. Commits ------- c402418 [HttpClient] add $response->cancel()
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] add $response->cancel() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11668 An alternative to #31845 and #31842. Same as #31831 but considered as a bug fix (at the Contracts level), thus for 4.3. I think we're early enough since 4.3/1.1 to do it. That will save us some headaches in the short term. Commits ------- c402418723 [HttpClient] add $response->cancel()
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] add $response->cancel() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11668 An alternative to #31845 and #31842. Same as #31831 but considered as a bug fix (at the Contracts level), thus for 4.3. I think we're early enough since 4.3/1.1 to do it. That will save us some headaches in the short term. Commits ------- c402418723 [HttpClient] add $response->cancel()
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] add $response->cancel() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11668 An alternative to #31845 and #31842. Same as #31831 but considered as a bug fix (at the Contracts level), thus for 4.3. I think we're early enough since 4.3/1.1 to do it. That will save us some headaches in the short term. Commits ------- c402418723 [HttpClient] add $response->cancel()
This can merged now :) |
d7c3a94
to
d29eb7e
Compare
components/http_client.rst
Outdated
}, | ||
]); | ||
|
||
The exception will be wrapped in an instance of ``TransportExceptionInterface`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately the symfony cloud endpoint for this PR is not bootstrapped yet :(
This belongs to the * throw an exception from a progress callback::
-Part, but I am not sure if it will be rendered correct with this indention
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, while merging we can reword this to remove the <ul>
list and turn it into paragraphs:
To abort a request (e.g. because it didn't complete in due time, or you want to
fetch only the first bytes of the response, etc.), you can either use the ``cancel()``
method of ``ResponseInterface``:
...
Or throw an exception from a progress callback::
...
The exception will be wrapped in an instance of ``TransportExceptionInterface``
and will abort the request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Nicolas 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice! Thanks Nicolas.
components/http_client.rst
Outdated
This means there is usually nothing to configure to have the client work with | ||
proxies, provided these env vars are properly configured. | ||
|
||
You can still set or override these settings using the `proxy`` and ``no_proxy`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a missing opening backtick in proxy
:
`proxy`` -> ``proxy``
components/http_client.rst
Outdated
}, | ||
]); | ||
|
||
The exception will be wrapped in an instance of ``TransportExceptionInterface`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, while merging we can reword this to remove the <ul>
list and turn it into paragraphs:
To abort a request (e.g. because it didn't complete in due time, or you want to
fetch only the first bytes of the response, etc.), you can either use the ``cancel()``
method of ``ResponseInterface``:
...
Or throw an exception from a progress callback::
...
The exception will be wrapped in an instance of ``TransportExceptionInterface``
and will abort the request.
Comments addressed, thank you all! |
Thank you Nicolas. |
…(nicolas-grekas) This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] doc how to cancel a request + upload files Fixes #11658. Needs symfony/symfony#31850 Commits ------- b096999 [HttpClient] doc how to cancel a request + upload files
This PR was merged into the 4.3 branch. Discussion ---------- [HttpClient] add $response->cancel() | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#11668 An alternative to #31845 and #31842. Same as #31831 but considered as a bug fix (at the Contracts level), thus for 4.3. I think we're early enough since 4.3/1.1 to do it. That will save us some headaches in the short term. Commits ------- c402418723 [HttpClient] add $response->cancel()
Fixes #11658. Needs symfony/symfony#31850