fn hook_status()

in src/plugin/plugin_swoole.rs [136:163]


    fn hook_status(&self) -> (Box<BeforeExecuteHook>, Box<AfterExecuteHook>) {
        (
            Box::new(|_, execute_data| {
                validate_num_args(execute_data, 1)?;

                let fd = get_this_mut(execute_data)?
                    .get_mut_property("fd")
                    .expect_long()?;

                let status = execute_data.get_parameter(0);
                let status = status
                    .as_long()
                    .map(|status| status as i32)
                    .or_else(|| {
                        status
                            .as_z_str()
                            .and_then(|status| status.to_str().ok())
                            .and_then(|status| status.parse::<i32>().ok())
                    })
                    .unwrap_or_default();

                SWOOLE_RESPONSE_STATUS_MAP.insert(fd, status);

                Ok(Box::new(()))
            }),
            Noop::noop(),
        )
    }