wacker-dev / waki

HTTP client and server library for WASI.
https://docs.rs/waki
Apache License 2.0
10 stars 0 forks source link
http-client http-server rust wasi wasm webassembly

waki

HTTP client and server library for WASI.

Send a request:

let resp = Client::new()
    .post("https://httpbin.org/post")
    .connect_timeout(Duration::from_secs(5))
    .send()?;

println!("status code: {}", resp.status_code());

Writing an HTTP component:

use waki::{handler, ErrorCode, Request, Response};

#[handler]
fn hello(req: Request) -> Result<Response, ErrorCode> {
    Response::builder().body(b"Hello, WASI!").build()
}