@maschinenlesbar.org/fit-connect-cli
    Preparing search index...

    Function baseUrlProblem

    • Why value cannot be used as the base URL, or undefined when it can. The engine appends every request path to the base URL as a string, so the rules guard the request URL it builds:

      • it must be a string that parses as an absolute URL with an http: or https: scheme (a file: or ftp: base URL would otherwise reach a custom transport that does no such check);
      • no ? or #: either would swallow every path (http://h/?x=1 requests /?x=1/v2/..., http://h/#f requests /);
      • no backslash: WHATWG ends an http(s) host at one, as at a /, while text-based code reads on, so https://u:pw@a.example\@b.example was checked as a.example and its credentials could go to b.example;
      • a % in the user name or password must start a valid escape (%25 for a literal one): Node decodes the userinfo for the Authorization header and fails at request time;
      • no surrounding whitespace (U+00A0 included) and no control character anywhere: new URL() trims or drops them silently, so the URL requested would not be the one typed ("https://h/ " read as https://h/, a tab inside a host dropped);
      • the scheme followed by exactly // and the host (not http:host, http:/host or http:///host): WHATWG skips any slashes after an http(s) scheme and repairs the URL silently, so the host requested would not be the one typed either.

      The reasons never repeat the value, nor a part of it, so a credential in it cannot reach a message: a scheme is named (Unsupported scheme "ftp:") only when the value spells one (<scheme>://), since a scheme-less user:password@host parses with the user name as its scheme. The engine enforces it (as Invalid baseUrl: <reason>), and the CLI's --base-url parser calls it.

      Parameters

      • value: string

      Returns string | undefined