Skip to main content

featherbit/plugins/native/
client.rs

1//! The `client` node — the fixed terminal point of every policy graph.
2
3use async_trait::async_trait;
4
5use crate::context::Context;
6use crate::plugins::{Plugin, PluginOutput, PluginResult};
7
8/// The Client node is the terminal node in a routing policy.
9/// When the context reaches this node, the response is sent to the client.
10/// It is a passthrough — it does not modify the context.
11///
12/// Graph execution stops here: whatever `Context.response` holds at this point
13/// is what the server writes back to the caller. It takes no configuration.
14pub struct ClientPlugin;
15
16#[async_trait]
17impl Plugin for ClientPlugin {
18    fn plugin_type(&self) -> &str {
19        "client"
20    }
21
22    fn reads_response_body(&self) -> bool {
23        false
24    }
25
26    async fn execute(&self, ctx: Context) -> PluginResult {
27        Ok(PluginOutput::success(ctx))
28    }
29}