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

    Class RequestEngine

    Index
    • The request URL as error messages show it: absolute (so a message names the host that gave a bad answer, which matters with a custom base URL), userinfo redacted and cut at MAX_MESSAGE_VALUE_LENGTH characters. An answer error reads GET <this>: …, like a network error (GET <this> failed: …); the client's own parse errors use it too.

      Parameters

      Returns string

    • GET a path and return the decoded text (a CSV file). Guards against the two common non-CSV replies: an HTML error page (wrong path / the file moved) and an empty body — both surface as a clear BundeswahlParseError rather than reaching the CSV parser.

      NOTE: the response's media type is intentionally ignored. The site/CDN serves the CSVs with varying types (text/csv, text/plain, application/octet-stream), so we sniff the body — an <!doctype html> / <html> prefix is the HTML guard — rather than trust the header. Don't "harden" this into Content-Type validation; it would reject valid files. Only its charset parameter is read (see decodeCsvBody).

      Parameters

      Returns Promise<string>

    • A value from an answer quoted for an error message (quoteValue: JSON-quoted, invisible characters escaped, cut at 500 characters), the base URL's credentials scrubbed first, before the cut: a 2xx answer (a CSV cell or header name the client refuses) can echo them as well as an error body. The client quotes every server value with this.

      Parameters

      • value: string

      Returns string

    • Perform a GET with Accept negotiation and transient-error retries. Redirects are NOT followed — a 3xx surfaces as an error.

      Parameters

      • path: string
      • Optionalquery: QueryParams
      • accept: string = "text/csv, text/plain, */*"

      Returns Promise<RawResponse>