Can GuzzleHttp be used to listen to a specific event to obtain request body data?
YunYami opened this issue · comments
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.
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