Named param values are percent-encoded for use in a path segment: characters
that would change the URL structure (/, ?, #, %, whitespace, non-ASCII)
are escaped, while characters that RFC 3986 allows literally in a path
segment ($ & + , ; = : @) are kept as-is. Note this differs from query-string
encoding (encodeURIComponent/URLSearchParams), where those characters are
delimiters and must be escaped. Splat (*) values are interpolated without
per-segment encoding. Leading URL separators and schemes are handled so
interpolated values remain paths.
Returns a path with params interpolated.
Named param values are percent-encoded for use in a path segment: characters that would change the URL structure (
/,?,#,%, whitespace, non-ASCII) are escaped, while characters that RFC 3986 allows literally in a path segment ($ & + , ; = : @) are kept as-is. Note this differs from query-string encoding (encodeURIComponent/URLSearchParams), where those characters are delimiters and must be escaped. Splat (*) values are interpolated without per-segment encoding. Leading URL separators and schemes are handled so interpolated values remain paths.See RFC 3986 §3.3