-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(HTTPClient): Provide wrapped access to Guzzle's asyncRequest() #38613
Conversation
Tests and docs will follow after my vacation. |
8a73fc2
to
f47135b
Compare
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.
Looks good
if ($onFulfilled !== null) { | ||
$wrappedOnFulfilled = static function (ResponseInterface $response) use ($onFulfilled) { | ||
$onFulfilled(new Response($response)); | ||
}; | ||
} else { | ||
$wrappedOnFulfilled = null; | ||
} |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
ec6728d
Compare
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