@maschinenlesbar.org/bundesrat-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. Every error about an answer starts with GET <this>: , like a network error's GET <this> failed: .

      Parameters

      Returns string

    • GET a feed path and parse the XML reply. The Bundesrat feeds require the view=renderXml render parameter; without it the server returns its HTML shell, which we detect and reject with a helpful BundesratParseError.

      NOTE: the response Content-Type does not decide whether the body is a feed. The Government Site Builder CMS is inconsistent about the media type (feeds have been seen as text/plain, application/xml, text/html), so we sniff the body — an <!doctype html> / <html> prefix is the HTML-shell guard — rather than trust the header. Don't "harden" this by validating Content-Type; it would reject valid feeds. Only its charset is used, to decode a body that declares no encoding (decodeXml).

      Parameters

      Returns Promise<XmlValue>

    • A value from an answer quoted for an error message (quoteValue), the base URL's credentials scrubbed first, before the cut: a 2xx answer (a root element the client refuses) can echo them as well as an error body. API code quotes server values 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 (the canonical host answers directly).

      Parameters

      • path: string
      • Optionalquery: QueryParams
      • accept: string = "application/xml"

      Returns Promise<RawResponse>