kinetex - v1.4.0
    Preparing search index...

    Class Redactor

    Redacts sensitive data from headers, URLs, and request/response bodies before they are written to log output.

    Index
    • Redact sensitive header values, replacing them with "***".

      Parameters

      • headers: Record<string, string>

      Returns Record<string, string>

    • Redact sensitive query parameters from a URL.

      Absolute URLs go through URL, which also normalises the result. A URL the URL constructor rejects — every relative form, and relative forms are what HTTPLogger.child's own example logs — used to be returned untouched, so logRequest(id, "GET", "/users?token=abc", ...) wrote the token in clear while the absolute spelling of the same request redacted it. Those fall back to a textual scan of the query string below.

      Parameters

      • url: string

      Returns string

    • Redact and optionally truncate a request or response body.

      Parameters

      • body: string | Uint8Array<ArrayBufferLike> | null
      • contentType: string | null
      • isResponse: boolean

      Returns { body: string | null; size: number | null }

      An object containing body (the redacted/truncated body string, or null) and size (the original byte size, or null).

      • body: string | null

        The redacted/truncated body string, or null.

      • size: number | null

        The original byte size, or null.