-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add info about HTTP client events. #7769
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
Conversation
en/core-libraries/httpclient.rst
Outdated
| --------------------- | ||
|
|
||
| // Somewhere before calling one of the HTTP client's send methods. | ||
| \Cake\Event\EventManager::instance()->on( |
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.
Aren't events only dispatched on the client object and not on the global event manager?
I just learned instance level events will also appear in the global event manager.
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.
Hmm.. This makes me think that suggesting $client->getEventManager()->on() would be better.
fff1aa5 to
f701891
Compare
| --------------------- | ||
|
|
||
| // Somewhere before calling one of the HTTP client's methods which makes a request | ||
| $http->getEventManager()->on( |
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.
| $http->getEventManager()->on( | |
| $client->getEventManager()->on( |
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.
All code examples above use the var $http for the client instance, hence I used the same for consistency.
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.
The example on 480 uses $client. I can take care of normalizing them all though.
| --------------------- | ||
|
|
||
| // Somewhere before calling one of the HTTP client's methods which makes a request | ||
| $http->getEventManager()->on( |
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.
| $http->getEventManager()->on( | |
| $client->getEventManager()->on( |
Refs cakephp/cakephp#17416