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

    Class RequestEngine

    Index
    bigIntegerKeys: ReadonlySet<string>

    EngineOptions.bigIntegerKeys, copied.

    • Build a fully-qualified URL from a path (all parameters travel in the body).

      Parameters

      • path: string

      Returns string

    • 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.

      Parameters

      • path: string

      Returns string

    • POST a JSON payload and parse the JSON reply into T. Every MUDAB endpoint answers with a JSON document, so an empty body (or a 204) is a MudabParseError, not an empty result, and so is a number JSON.parse cannot carry exactly (firstInexactNumber): out of a double's range, past 2^53 in any written form, or non-zero and too small, which would print as null, a rounded value or 0. Every error about the answer names the request (POST <url>: …, userinfo redacted).

      The text is never changed silently: bytes that are not valid in the charset, and lone surrogates written as JSON escapes (\ud800), are replaced with U+FFFD, so the result is well-formed text (jq rejects a lone surrogate, and with it the whole output), and onWarning is told how many. One bad character never sinks a whole answer.

      Type Parameters

      • T

      Parameters

      • path: string
      • payload: unknown

      Returns Promise<T>

    • Perform a request with Accept negotiation and transient-error retries.

      Redirects are deliberately NOT followed: the canonical host answers directly, and following a cross-origin 3xx blindly is a footgun. A 3xx therefore surfaces as a MudabApiError naming the redirect target (location).

      Parameters

      • method: string
      • path: string
      • options: { accept: string; body?: Buffer<ArrayBufferLike> } = ...

      Returns Promise<RawResponse>

    • text without the base URL's credentials: server text (an error body that echoes the request URL, the Authorization header or the decoded user:password) and transport text (fetch's "Failed to fetch ") can carry them.

      Parameters

      • text: string

      Returns string