# Radegast An HTTP client for picodata apps. Non blocking, fiber friendly, driven by [CBUS](https://git.picodata.io/picodata/picodata/tarantool-module/-/blob/master/tarantool/src/cbus/mod.rs). Build over [reqwest](https://github.com/seanmonstar/reqwest) client. This client has a similar API as `reqwest` crate (see [docs](https://docs.rs/reqwest/latest/reqwest/) for more). # Usage example The main difference between this crate and `reqwest` is the HTTP client initialization. First, initialize client using client builder: ```rust use radegast::ClientBuilder; use tarantool::cbus; use tarantool::fiber::Fiber; pub const CBUS_ENDPOINT: &str = "tests_endpoint"; // initialize cbus first pub fn init_cbus() { let mut fiber = Fiber::new("cbus_endpoint_f", &mut |_: Box<()>| { let cbus_endpoint = cbus::Endpoint::new(CBUS_ENDPOINT).unwrap(); cbus_endpoint.cbus_loop(); 0 }); fiber.start(()); } fn main() { init_cbus(); let client = radegast::ClientBuilder::new().build(CBUS_ENDPOINT).unwrap(); } ``` If you want, you can manually define a tokio runtime (instead of [default](https://git.picodata.io/picodata/picodata/radegast/-/blob/main/radegast/src/lib.rs#L13)) for run HTTP requests and `reqwest` client underline instance (see `ClientBuilder` methods). Now you have the opportunity to make an HTTP request: ```rust let response = client.get("https://google.ru").send().unwrap(); println!("{response:?}"); ``` To familiarize with request APIs you can see the [reqwest](https://docs.rs/reqwest/latest/reqwest/) docs. ## Tests We use [tarantool-test](https://crates.io/crates/tarantool-test). Run tests: ``` cargo build tarantool-test -p ./target/debug/libtests.so ```