Crates.io | format-url |
lib.rs | format-url |
version | 0.6.2 |
source | src |
created_at | 2022-08-22 13:47:13.544408 |
updated_at | 2022-08-26 07:23:33.713752 |
description | Make building URLs more ergonomic. |
homepage | https://github.com/alextes/format-url |
repository | |
max_upload_size | |
id | 650388 |
size | 9,095 |
Format URLs for fetch requests using templates and substitution values.
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");