@maschinenlesbar.org/pegel-online-cli
    Preparing search index...

    Class RequestEngine

    Index
    bigIntegerKeys: ReadonlySet<string>

    EngineOptions.bigIntegerKeys, copied.

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

      Throws a PegelValidationError for a path with a "." or ".." segment. The resource methods put ids into the path with encodeURIComponent, which leaves those two unchanged, and URL parsing then resolves them: currentMeasurement("BONN", "..") would request /stations/currentmeasurement.json (a station of that name). Neither can name a resource. (Percent-encoded forms such as "%2e%2e" are safe: encodeURIComponent turns their "%" into "%25".)

      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 500 characters. It never throws: describing a URL for a message 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 a PegelParseError: every endpoint answers with a JSON document. Every error about the answer names the request (GET <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

      Returns Promise<T>

    • A value from an answer (a station field, a header) as a message may quote it: the base URL's credentials replaced by ***, in every form a server echoes them in. API code scrubs a server value with this before it cleans or cuts it (serverTextForMessage, cleanDetail): a cut first could split a password and leave its prefix, which no exact-string scrub finds again.

      Parameters

      • text: string

      Returns string