packages

http

0.1.0官方

HTTP/1.1 and HTTP/2 client and server: strict parsing, HPACK, streaming bodies, connection pooling

發布於 · MIT OR Apache-2.0 · 0 個相依套件

官方套件:只寫 use http::..; 就夠了,第一次建置會新增它。或者:

nabi add http

然後在程式碼中

use http;
deps: {
    "http": Dep::version("^0.1.0"),
},

CI packages.nabi-lang.org License: MIT OR Apache-2.0

HTTP/1.1 and HTTP/2 for Nabi: a message model, a pooling client and an async server, over plaintext or TLS 1.3. Built on std::net with no other dependencies. Parsing is strict where leniency would allow request smuggling or response splitting.

Add it

nabi add http

Needs Nabi 0.1 or later.

Features http1, http2 and tls are on by default; turn off what you do not need with default_features: false.

Usage

// One-off request with a default client.
async fn main() throws {
    let r = try await http::get("http://example.com/");
    println(f"{r.status} {r.headers.get("content-type") ?? "-"}");
    println(try await r.body.text());
}

The server is router-free: one async fn(Request) -> Response handler, served with http::serve / http::serve_tls. See the API docs for the client, server and TLS details.

Docs

https://packages.nabi-lang.org/packages/http/latest/docs

License

Licensed under either of MIT or Apache-2.0, at your option.

README 來自 github.com/nabi-lang/http,提交 40606e55。