set_query

fn set_query(self: &mut Self, query: Option<&str>)

Change this URL’s query string. If query is None, this URL's query string will be cleared.

Examples
use url::Url;

let mut url = Url::parse("https://example.com/products")?;
assert_eq!(url.as_str(), "https://example.com/products");

url.set_query(Some("page=2"));
assert_eq!(url.as_str(), "https://example.com/products?page=2");
assert_eq!(url.query(), Some("page=2"));
Run