Skip to content

Commit

Permalink
Support Swoole\Http\Server
Browse files Browse the repository at this point in the history
  • Loading branch information
jmjoy committed Nov 30, 2024
1 parent 954971b commit e273dc7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugin/plugin_swoole.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ pub struct SwooleServerPlugin;
impl Plugin for SwooleServerPlugin {
#[inline]
fn class_names(&self) -> Option<&'static [&'static str]> {
Some(&[r"Swoole\Server", r"Swoole\Coroutine\Http\Server"])
Some(&[
r"Swoole\Server",
r"Swoole\Http\Server",
r"Swoole\Coroutine\Http\Server",
])
}

#[inline]
Expand All @@ -42,7 +46,7 @@ impl Plugin for SwooleServerPlugin {
&self, class_name: Option<&str>, function_name: &str,
) -> Option<(Box<BeforeExecuteHook>, Box<AfterExecuteHook>)> {
match (class_name, function_name) {
(Some(r"Swoole\Server"), "on") => Some(self.hook_on()),
(Some(r"Swoole\Server" | r"Swoole\Http\Server"), "on") => Some(self.hook_on()),
(Some(r"Swoole\Coroutine\Http\Server"), "handle") => Some(self.hook_handle()),
_ => None,
}
Expand Down

0 comments on commit e273dc7

Please sign in to comment.