Norma.Normalizer (Norma v2.0.1)

Copy Markdown View Source

Applies option-driven normalization steps to a parsed %URI{}.

Called by Norma after validation and URI.parse/1. Options match the public Norma.normalize/2 API (remove_fragment, force_root_path, add_root_path, add_trailing_slash, remove_www, remove_scheme).

Host case folding is not an option: Utils.form_url/2 always runs :uri_string.normalize/1, which downcases the host (2.0 D6/D8).

Summary

Functions

Normalizes the given url, accepts the following options

Types

option_key()

@type option_key() ::
  :remove_fragment
  | :force_root_path
  | :add_root_path
  | :add_trailing_slash
  | :remove_www
  | :remove_scheme

options()

@type options() :: %{optional(option_key()) => boolean()}

Functions

normalize(url, options \\ %{})

@spec normalize(URI.t(), options()) :: String.t()

Normalizes the given url, accepts the following options:

  • remove_fragment
  • force_root_path
  • add_root_path
  • add_trailing_slash
  • remove_www