Uh oh!
There was an error while loading. Please reload this page.
feat(HTTPClient): Provide wrapped access to Guzzle's asyncRequest() - #38613
Conversation
nickvergessen
commented
Jun 2, 2023
Tests and docs will follow after my vacation. |
Uh oh!
There was an error while loading. Please reload this page.
8a73fc2 to
f47135bCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
nickvergessen
commented
Jun 27, 2023
Uh oh!
There was an error while loading. Please reload this page.
| if ($onFulfilled !== null) { | ||
| $wrappedOnFulfilled = static function (ResponseInterface $response) use ($onFulfilled) { | ||
| $onFulfilled(new Response($response)); | ||
| }; | ||
| } else { | ||
| $wrappedOnFulfilled = null; | ||
| } |
There was a problem hiding this comment.
What does that do?
And the wrapping around onRejected is even weirder as it seems to just pass on the call?
There was a problem hiding this comment.
Oh it wraps the internal $response object in something from OCP, right? Then I get it, but I do not get the one for onRejected.
There was a problem hiding this comment.
yeah it's about only exposing OCP.
Same basically on the rejection, we are removing the Guzzle "type hint" and just require a \Exception eating closure instead of a GuzzleHttp\Exception\RequestException one.
Signed-off-by: Joas Schilling <coding@schilljs.com>
8b13f2e to
ec6728dComparenickvergessen
commented
Jun 27, 2023
Rebased and squashed |
Summary
Following the approach discussed in #35959 to allow making async requests, e.g. required for interaction with webhooks in a non-blocking way.
Sample usage
Checklist