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

    Class RequestEngine

    Index
    • Build a fully-qualified URL from a path and optional query parameters.

      Throws an AutobahnValidationError for a path with a "." or ".." segment. The client puts road ids and identifiers into the path with encodeURIComponent, which leaves those two unchanged, and URL parsing then resolves them: roadworks list .. would request /o/services/roadworks and report "no roadworks" with exit 0. Neither can name a resource. (Percent-encoded forms such as "%2e%2e" are safe: encodeURIComponent turns their "%" into "%25".) The client rejects such ids first, with a message about the id (validate.ts idProblem); this guard is the backstop for a direct getJson/request caller.

      Parameters

      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. It never throws: describing a URL for a message or a log line does not validate it (buildUrl does).

      Parameters

      Returns string

    • Perform a GET expecting JSON and parse it into T. An empty (or whitespace-only) body is an AutobahnParseError, or with emptyIsNotFound an AutobahnNotFoundError that names the status the server really sent.

      Type Parameters

      • T

      Parameters

      • path: string
      • Optionalquery: QueryParams
      • options: { emptyIsNotFound?: boolean } = {}

      Returns Promise<T>