Skip to content
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

[8.x] Add handlerStats method for Http Client #35520

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

stephenstack
Copy link
Contributor

Third time lucky? Happy to submit on 8.x branch :)

Previous to this PR, retrieving handlerStats from the Http Client response was not intuitive or documented. The withOptions method fails with an error using Guzzle 'on_stats', and $response->transferStats->getHandlerStats() is not documented. To get handler stats required reverse engineering the Response.php class to some extent to figure out that getHandlerStats() can be called from the $response->transferStats property .

This PR addresses the issue, by mimicking behaviour of the 'effectiveUri()' method from the Response.php class, but the PR implements a new method calling the Guzzle getHandlerStats() method direct and returning handlerStats from the $this->transferStats property/object.

@taylorotwell taylorotwell merged commit b57b61c into laravel:8.x Dec 7, 2020
/**
* Get the handler stats of the response.
*
* @return \Psr\Http\Message\UriInterface
Copy link
Member

Choose a reason for hiding this comment

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

This return type is wrong.

@stephenstack
Copy link
Contributor Author

Will try to get a new PR to update to the correct return type today. Thanks

@GrahamCampbell
Copy link
Member

It's already fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants