proxy-wasm-rust-sdk
proxy-wasm-rust-sdk copied to clipboard
How to handle HTTP request callback in "on_tick" method
fn on_tick(&mut self) { unsafe { self.dispatch_http_call( &VM_CONFIG_GLBOAL.gatewaycluster, vec![ (":method", "GET"), ( ":path", "/hello", ), (":authority","hello"), ], None, vec![], Duration::from_secs(1), ) .unwrap(); } }
impl Context for PluginRootContext {
fn on_http_call_response(&mut self, _token_id: u32, _num_headers: usize, _body_size: usize, _num_trailers: usize) {
/*
The code that handles dispatched http response
*/
}
}
impl RootContext for PluginRootContext {
fn on_tick(&mut self) {
self.dispatch_http_call(...);
}
}
thanks @ismailbaskin