feat: get_match_config returns with rule_id for stateful plugins (#406)

This commit is contained in:
纪卓志
2023-07-04 19:59:43 +08:00
committed by GitHub
parent b65446fa25
commit d718870b65
2 changed files with 16 additions and 13 deletions

View File

@@ -13,7 +13,7 @@
// limitations under the License.
use higress_wasm_rust::log::Log;
use higress_wasm_rust::rule_matcher::{on_configure, RuleMatcher};
use higress_wasm_rust::rule_matcher::{on_configure, RuleMatcher, SharedRuleMatcher};
use proxy_wasm::traits::{Context, HttpContext, RootContext};
use proxy_wasm::types::{Action, ContextType, LogLevel};
use serde::Deserialize;
@@ -28,11 +28,11 @@ proxy_wasm::main! {{
struct SayHelloRoot {
log: Log,
rule_matcher: Rc<RefCell<RuleMatcher<SayHelloConfig>>>,
rule_matcher: SharedRuleMatcher<SayHelloConfig>,
}
struct SayHello {
rule_matcher: Rc<RefCell<RuleMatcher<SayHelloConfig>>>,
rule_matcher: SharedRuleMatcher<SayHelloConfig>,
}
#[derive(Default, Debug, Deserialize)]
@@ -82,7 +82,7 @@ impl HttpContext for SayHello {
self.send_http_response(200, vec![], Some("Hello, World!".as_bytes()));
return Action::Continue;
}
Some(config) => config,
Some(config) => config.1,
};
self.send_http_response(