4 个版本 (2 个破坏性更新)

0.3.1 2024 年 7 月 19 日
0.3.0 2024 年 6 月 14 日
0.2.0 2024 年 6 月 7 日
0.1.0 2024 年 6 月 5 日

#712WebAssembly

Download history · Rust 包仓库 277/week @ 2024-06-03 · Rust 包仓库 143/week @ 2024-06-10 · Rust 包仓库 47/week @ 2024-06-17 · Rust 包仓库 135/week @ 2024-06-24 · Rust 包仓库 101/week @ 2024-07-01 · Rust 包仓库 104/week @ 2024-07-08 · Rust 包仓库 201/week @ 2024-07-15 · Rust 包仓库 80/week @ 2024-07-22 · Rust 包仓库 188/week @ 2024-07-29 · Rust 包仓库 80/week @ 2024-08-05 · Rust 包仓库

每月 553 次下载

Apache-2.0

40KB
858

waki

WASI 的 HTTP 客户端和服务器库。

发送请求

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

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

编写 HTTP 组件

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

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

lib.rs:

waki

WASI 的 HTTP 客户端和服务器库。

发送请求

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

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

编写 HTTP 组件

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

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

依赖项

~2.3–3.5MB
~94K SLoC