4个版本 (2个重大更新)

0.6.2 2022年8月26日
0.6.1 2022年8月22日
0.5.0 2022年8月22日
0.4.0 2022年8月22日

#361HTTP客户端

Download history · Rust 包仓库 456/week @ 2024-04-09 · Rust 包仓库 294/week @ 2024-04-16 · Rust 包仓库 510/week @ 2024-04-23 · Rust 包仓库 139/week @ 2024-04-30 · Rust 包仓库 705/week @ 2024-05-07 · Rust 包仓库 913/week @ 2024-05-14 · Rust 包仓库 1006/week @ 2024-05-21 · Rust 包仓库 608/week @ 2024-05-28 · Rust 包仓库 400/week @ 2024-06-04 · Rust 包仓库 520/week @ 2024-06-11 · Rust 包仓库 712/week @ 2024-06-18 · Rust 包仓库 1230/week @ 2024-06-25 · Rust 包仓库 775/week @ 2024-07-02 · Rust 包仓库 1005/week @ 2024-07-09 · Rust 包仓库 86/week @ 2024-07-16 · Rust 包仓库 78/week @ 2024-07-23 · Rust 包仓库

每月 2,262 次下载

MIT 许可证

9KB
171

使用模板和替换值格式化URL以进行fetch请求。

用法

use format_url::FormatUrl;

let url = FormatUrl::new("https://api.example.com/")
    .with_path_template("/user/:name")
    .with_substitutes(vec![("name", "alex")])
    .with_query_params(vec![("active", "true")])
    .format_url();

assert_eq!(url, "https://api.example.com/user/alex?active=true");

愿望清单

  • 支持列表和嵌套值。 (serde_urlencoded -> serde_qs)
  • 支持接收任何值作为查询参数,这些值可以由serde_urlencoded或serde_qs序列化。
  • 支持接收路径模板替换为(Hash)Map,甚至是一个具有匹配字段的struct。

lib.rs:

使用模板和替换值格式化URL以进行fetch请求。

用法

use format_url::FormatUrl;

let url = FormatUrl::new("https://api.example.com/")
    .with_path_template("/user/:name")
    .with_substitutes(vec![("name", "alex")])
    .with_query_params(vec![("active", "true")])
    .format_url();

assert_eq!(url, "https://api.example.com/user/alex?active=true");

愿望清单

  • 支持列表和嵌套值。 (serde_urlencoded -> serde_qs)
  • 支持接收任何值作为查询参数,这些值可以由serde_urlencoded或serde_qs序列化。
  • 支持接收路径模板替换为(Hash)Map,甚至是一个具有匹配字段的struct。

依赖项

~14KB