#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

#2 in #proper

Download history 25/week @ 2024-03-10 30/week @ 2024-03-31 53/week @ 2024-04-14

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