使用旧的Rust 2015
0.1.2 |
|
---|---|
0.1.1 |
|
0.1.0 |
|
#16 in #failed
8KB
153 代码行
reru
一个简单的Rust HTTP请求客户端,灵感来源于 unirest.
let mut res = String::new();
reru::post("https://httpbin.org/post")
.expect("failed to parse URL")
.param("show_env", "1")
.body_json(&["蟹", "Ferris"])
.expect("failed to serialize")
.request()
.expect("failed to send request")
.read_to_string(&mut res)
.expect("failed to read response");
println!("{}", res);
lib.rs
:
一个简单的HTTP请求客户端库。
#示例
let mut res = String::new();
reru::post("https://httpbin.org/post")
.expect("failed to parse URL")
.param("show_env", "1")
.body_json(&["蟹", "Ferris"])
.expect("failed to serialize")
.request()
.expect("failed to send request")
.read_to_string(&mut res)
.expect("failed to read response");
println!("{}", res);
依赖
~5MB
~120K SLoC