pub struct Options {Show 16 fields
pub default_protocol: 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: RemoveQueryParametersOptions,
pub keep_query_parameters: Option<Vec<Regex>>,
pub remove_trailing_slash: bool,
pub remove_single_slash: bool,
pub remove_directory_index: RemoveDirectoryIndexOptions,
pub remove_explicit_port: bool,
pub sort_query_parameters: bool,
}Expand description
Normalization options.
Fields§
§default_protocol: StringDefault protocol.
Default value: http.
normalize_protocol: boolPrepend defaultProtocol to the URL if it’s protocol-relative.
Default value: true.
force_http: boolNormalize HTTPS to HTTP.
Default value: false.
force_https: boolNormalize HTTP to HTTPS.
This option cannot be used with the force_http option at the same time.
Default value: false.
strip_authentication: boolStrip the authentication part of the URL.
Default value: true.
strip_hash: boolStrip the hash part of the URL.
Default value: false.
strip_protocol: boolRemove the protocol from the URL: http://sindresorhus.com → sindresorhus.com.
It will only remove https:// and http:// protocols.
Default value: false.
strip_text_fragment: boolStrip the text fragment part of the URL.
Note: The text fragment will always be removed if the strip_hash option is set to true, as the hash contains the text fragment.
Default value: true.
strip_www: boolRemove www. from the URL.
Default value: true.
remove_query_parameters: RemoveQueryParametersOptionsRemove query parameters that matches any of the provided strings or regexes.
Default value: ^utm_\w+.
keep_query_parameters: Option<Vec<Regex>>Keeps only query parameters that matches any of the provided strings or regexes.
Note: It overrides the remove_query_parameters option.
Default value: None.
remove_trailing_slash: boolRemove trailing slash.
Note: Trailing slash is always removed if the URL doesn’t have a pathname unless the remove_single_slash option is set to false.
Default value: true.
remove_single_slash: boolRemove a sole / pathname in the output. This option is independent of remove_trailing_slash.
Default value: true.
remove_directory_index: RemoveDirectoryIndexOptionsRemoves the default directory index file from path that matches any of the provided strings or regexes. When true, the regex ^index\.[a-z]+$ is used.
Default value: None.
remove_explicit_port: boolRemoves an explicit port number from the URL.
Port 443 is always removed from HTTPS URLs and 80 is always removed from HTTP URLs regardless of this option.
Default value: false.
sort_query_parameters: boolSorts the query parameters alphabetically by key.
Default value: true.