-
Notifications
You must be signed in to change notification settings - Fork 463
feat: add support for Guzzle 8 #9377
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -354,7 +354,9 @@ public static function createFromRpcStatus(Status $status) | |||||
| */ | ||||||
| public static function createFromRequestException(RequestException $ex, bool $isStream = false) | ||||||
| { | ||||||
| $res = $ex->getResponse(); | ||||||
| // Guzzle 7 carries the response on RequestException, Guzzle 8 only on | ||||||
| // its ResponseException subclass, hence the method_exists() check. | ||||||
| $res = method_exists($ex, 'getResponse') ? $ex->getResponse() : null; | ||||||
|
GrahamCampbell marked this conversation as resolved.
|
||||||
| $body = (string) $res->getBody(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this instance, we would get a PHP fatal error ("Call to a member function getBody() on If I am understanding this correctly, EVERY instance in Guzzle 7 which returned a response for Even so it might be a good idea to protect from fatal errors like this, and to add a comment in the method description that the method expects either a
Suggested change
|
||||||
| $decoded = json_decode($body, true); | ||||||
|
|
||||||
|
|
||||||
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.
nit