pub struct Options {Show 20 fields
pub default_protocol: Protocol,
pub custom_protocols: Vec<String>,
pub normalize_protocol: bool,
pub force_http: bool,
pub force_https: bool,
pub strip_authentication: bool,
pub strip_hash: bool,
pub strip_protocol: bool,
pub strip_text_fragment: bool,
pub strip_www: bool,
pub remove_query_parameters: RemoveQueryParameters,
pub keep_query_parameters: Option<Vec<QueryFilter>>,
pub remove_trailing_slash: bool,
pub remove_single_slash: bool,
pub remove_directory_index: RemoveDirectoryIndex,
pub remove_explicit_port: bool,
pub sort_query_parameters: bool,
pub empty_query_value: EmptyQueryValue,
pub remove_path: bool,
pub transform_path: Option<TransformPathFn>,
}Expand description
Options for URL normalization.
All options have sensible defaults matching the behavior of the original
normalize-url npm package.
Fields§
§default_protocol: ProtocolDefault protocol to prepend if missing.
Default: Protocol::Http
custom_protocols: Vec<String>Additional protocols to normalize (beyond http, https, file, data).
Protocols should be specified without :.
Default: vec![]
normalize_protocol: boolPrepend default_protocol to protocol-relative URLs.
Default: true
force_http: boolNormalize HTTPS to HTTP.
Default: false
force_https: boolNormalize HTTP to HTTPS. Cannot be used with force_http.
Default: false
strip_authentication: boolStrip the authentication part of the URL.
Default: true
strip_hash: boolStrip the hash/fragment part of the URL.
Default: false
strip_protocol: boolRemove the protocol from the URL.
Default: false
strip_text_fragment: boolStrip the text fragment part of the URL (#:~:text=...).
Default: true
strip_www: boolRemove www. from the URL.
Default: true
remove_query_parameters: RemoveQueryParametersControls removal of query parameters.
Default: RemoveQueryParameters::List with a single filter matching utm_*
keep_query_parameters: Option<Vec<QueryFilter>>If set, only keep query parameters matching these filters.
Overrides remove_query_parameters.
Default: None
remove_trailing_slash: boolRemove trailing slash from the path.
Default: true
remove_single_slash: boolRemove a sole / pathname in the output.
Default: true
remove_directory_index: RemoveDirectoryIndexRemove directory index files matching the given filters.
Default: RemoveDirectoryIndex::None
remove_explicit_port: boolRemove explicit port numbers.
Default: false
sort_query_parameters: boolSort query parameters alphabetically by key.
Default: true
empty_query_value: EmptyQueryValueControls how empty query parameter values are formatted.
Default: EmptyQueryValue::Preserve
remove_path: boolRemove the entire URL path, leaving only the domain.
Default: false
transform_path: Option<TransformPathFn>Custom function to transform path components.
Default: None