-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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] Adds new RequestSent
and ResponseReceived
events to the HTTP Client
#37572
[8.x] Adds new RequestSent
and ResponseReceived
events to the HTTP Client
#37572
Conversation
RequestSent
and ResponseReceived
events to the HTTP Client.RequestSent
and ResponseReceived
events to the HTTP Client.
Renamed to Thoughts? |
Why not include the request object in the first event? |
I agree having the full |
@taylorotwell agreed. Also agreed on the received event having the response object. I'll refactor when I'm back at my keyboard. |
RequestSent
and ResponseReceived
events to the HTTP Client.RequestSent
and ResponseReceived
events to the HTTP Client
Okay @taylorotwell @GrahamCampbell, I've moved the firing of the I've also made the |
Also @taylorotwell, completely understand if not (because seeing 'Request' as the first word makes sense in one way), but would it be worth considering |
Hey guys,
This PR adds two new events,
RequestSent
andResponseReceived
, which are dispatched by the Http Client.RequestSent
The
RequestSent
event is fired when any request is made when calling any of the following Http Client methods: 'get', 'head', 'post', 'put' and 'delete'. It receives the HTTP method, URL, and any sent options.ResponseReceived
The
ResponseReceived
event is fired when a successful response is returned from the Http Client. It receives theResponse
instance.What are the benefits?
These two events allow a 3rd party package to listen for and react to HTTP Client requests. I can see it being used for debugging, logging, performance monitoring, service downtime analysis and more.
I decided to contribute this when I went to create a PR for the
spatie/laravel-ray
package to allow monitoring of Http Client requests only to realise there wasn't a way to do so.As always, thank you very much for all the hard work and for considering my PR.
Regards,
Luke