-
Notifications
You must be signed in to change notification settings - Fork 282
Request hook #5433
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
base: main
Are you sure you want to change the base?
Request hook #5433
Conversation
| */ | ||
| final public static function postDispatch(Request $request): void | ||
| { | ||
| array_map( |
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.
Why array_map? You don't use its result.
Add a hook that hooks into different states of a request. The implementation starts with hooking into after non xhr requests are dispatched. This is meant to be extended for more more states like before a request gets dispatched.
Ensuring the request is no xhr request.
Al2Klimov
left a comment
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.
@lippserd, what do you think about the following?
| if ($this->isXhr()) { | ||
| $this->postDispatchXhr(); | ||
| } else { | ||
| RequestHook::postDispatch($req); |
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.
I think letting the hook decide would be clever AND smart. I mean, anyone could provide a hook... and wonder why some requests are missing. If $this->isXhr() is too heavy just with $req, we can pass additional arguments like a bool.
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.
I already discussed this w/ @jrauh01. We will call postDispatch() unconditionally.
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.
@jrauh01 Please also add the following to our Request:
public function isAutoRefresh(): bool
{
return $this->getHeader('X-Icinga-Autorefresh');
}
Add a
RequestHookthat hooks into different states of a request. The implementation starts with hooking into after non xhr requests are dispatched. This is meant to be extended for more more states like for example before a request gets dispatched.