#query-string #url #dynamic #encoding #proper #generate

urlcat

a simple tool to help easily generate dynamic urls with proper encoding

4 releases

0.2.2 May 4, 2023
0.2.1 May 4, 2023
0.1.5 May 3, 2023

#1 in #proper

Download history 7/week @ 2024-02-22 5/week @ 2024-02-29 19/week @ 2024-03-07 6/week @ 2024-03-14 20/week @ 2024-03-28 10/week @ 2024-04-04 2/week @ 2024-04-11 51/week @ 2024-04-18

83 downloads per month

GPL-3.0-or-later

16KB
89 lines

urlcat

Inspired by urlcat

What is this?

This package urlbat rewritten in rust

Features

  • sorts the querystring
  • correctly escapes values

Simple example showing what it can do

use std::collections::HashMap;
use urlcat::urlcat;

fn main() {
    let url = urlcat(
        "https://example.com/",
        "path/:crab/resource",
        HashMap::from([
            ("pretty", "cool/+/& yep".to_string()),
            ("really", "cool/+/& probably".to_string()),
            ("crab", "🦀".to_string()),
        ]);
    );
    assert_eq!(
        url,
        "https://example.com/path/🦀 well actually (%F0%9F%A6%80)/resource?pretty=cool%2F%2B%2F%26+yep&really=cool%2F%2B%2F%26+probably"
    );
}

Dependencies