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

Can GuzzleHttp be used to listen to a specific event to obtain request body data? #3190

Open
YunYami opened this issue Nov 3, 2023 · 3 comments

Comments

@YunYami
Copy link

YunYami commented Nov 3, 2023

The version I am using is 7.3.

I attempted to listen through Laravel's Illuminate\Http\Client\Events\RequestSending event, but found that it wasn't triggering.

I'm looking to collect the request body of all cURL requests in the project as part of a logging mechanism, without making modifications to code that involves the requests.

I'm hoping for assistance with this.

@mfn
Copy link

mfn commented Nov 3, 2023

Middlewares can do this https://docs.guzzlephp.org/en/stable/handlers-and-middleware.html

Unfortunately there's no logging example there and it's not really straightforward to understand how to do that.

Here's a random google result result I found which hopefully helps you https://github.com/gmponos/guzzle-log-middleware

Copy link

stale bot commented Mar 17, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale No activity for a long time label Mar 17, 2024
@YunYami
Copy link
Author

YunYami commented Mar 17, 2024 via email

@stale stale bot removed the lifecycle/stale No activity for a long time label Mar 17, 2024
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

No branches or pull requests

2 participants