Skip to content

basalt / http/src / redactUrl

Function: redactUrl() ​

> redactUrl(url): string

Defined in: http/src/redact-url.ts:24

Keeps the path and the parameter NAMES (useful for debugging) and replaces every query VALUE with REDACTED. The fragment is dropped. Works on a path (/a?b=c) and on an absolute URL (https://h/a?b=c) alike, and never decodes anything — whatever follows the first = of a pair is masked, however it is encoded; a valueless entry (a bare ?<token>) and a name that does not look like one are masked as well.

Parameters ​

url ​

string

Returns ​

string

Released under the MIT License.