@maschinenlesbar.org/fragdenstaat-cli
    Preparing search index...

    Function decodeBody

    • Decode a response body by the charset its Content-Type names (UTF-8 when it names none). TextDecoder drops a leading byte order mark, which Buffer#toString keeps and JSON.parse then rejects, so a BOM added by a proxy or a backend change cannot turn a valid answer into a parse error, and a Latin-1 body keeps its umlauts. An unknown charset label is an FdsParseError naming request (GET <url>, as the engine's messages start). Bytes that are not valid in the charset become U+FFFD; decodeText also counts them.

      Parameters

      • body: Buffer
      • contentType: string
      • request: string

      Returns string