#url #parse-url #modification #parser #free #operations #whatwg

unrestrictive-url

A library for parsing and freely modifying URLs

2 unstable releases

0.1.0 Mar 17, 2021
0.0.0 Mar 7, 2021

#14 in #whatwg


Used in humanize-url

Apache-2.0 OR MIT

10KB
157 lines

unrestrictive-url

A lightweight wrapper around url to allow for free URL modification.

The url crate strictly follows the WHATWG standard which means that some operations (like changing the protocol from https to whatever) are strictly forbidden.

This crate is a lightweight wrapper around the url crate. It uses url to parse a URL but allows for free modification afterwards. UnrestrictiveUrls implement std::fmt::Display.

Example

use unrestrictive_url::{Url, UnrestrictiveUrl};

let url = Url::parse("https://github.com").unwrap();
let mut url = UnrestrictiveUrl::from(&url);
url.scheme = Some("jojo");

assert_eq!("jojo://github.com/", url.to_string());

Dependencies

~2.1–3MB
~56K SLoC