pub trait Plugin: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn info(&self) -> PluginInfo;
// Provided methods
fn on_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_request_body<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_body: &'life2 mut Option<Bytes>,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
fn on_response_body(
&self,
_config: &Value,
_body: &mut Option<Bytes>,
_ctx: &mut HttpContext,
) -> Result<(), PluginError> { ... }
fn on_logging<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_: &'life1 Value,
_: &'life2 mut HttpContext,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Required Methods§
Provided Methods§
Sourcefn on_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_request<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
请求阶段,可改写头部
Sourcefn on_request_body<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_body: &'life2 mut Option<Bytes>,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_request_body<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_body: &'life2 mut Option<Bytes>,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
请求体阶段,可改写请求体
Sourcefn on_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn on_response<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_config: &'life1 Value,
_head: &'life2 mut Parts,
_ctx: &'life3 mut HttpContext,
) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
响应阶段,可改写头部
Sourcefn on_response_body(
&self,
_config: &Value,
_body: &mut Option<Bytes>,
_ctx: &mut HttpContext,
) -> Result<(), PluginError>
fn on_response_body( &self, _config: &Value, _body: &mut Option<Bytes>, _ctx: &mut HttpContext, ) -> Result<(), PluginError>
响应体阶段,可改写响应体