#query-string #url #dynamic

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

#48 in #query-string

Download history 33/week @ 2024-09-23 3/week @ 2024-09-30

69 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