Build a fully-qualified URL from a path and optional query parameters.
Throws a DdbError for a path with a "." or ".." segment. The client puts ids,
collections and request handlers into the path with encodeURIComponent, which
leaves those two unchanged, and URL parsing then resolves them: a collection of
".." with handler "version" would request /2/search/version. Neither can name
a resource. (Percent-encoded forms such as "%2e%2e" are safe:
encodeURIComponent turns their "%" into "%25".)
Optionalquery: QueryParamsThe 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 (https://***@host)
and cut at MAX_MESSAGE_URL_LENGTH characters (messageUrl). It never throws: describing a
URL for a message does not validate it (buildUrl does).
Optionalquery: QueryParamsPerform a GET expecting JSON and parse it into T (parseJson).
Optionalquery: QueryParamsPerform a GET returning the raw bytes (binary downloads).
Optionalquery: QueryParamsOptionalfollowRedirect: (target: URL) => booleanPerform a GET returning the decoded response body as text (e.g. /version).
Optionalquery: QueryParamsA JSON answer, decoded by its charset and parsed. Every error about the answer is a
DdbParseError that names the request (request, as GET <url>, userinfo redacted):
an unknown charset, an empty body (every JSON answer is a document; read as "nothing", it
let a script carry on as if the API had found nothing), a body that isn't JSON (naming its
Content-Type when that isn't JSON either: an HTML maintenance or proxy page), and a number
JSON.parse can't carry exactly. Declared big integers (bigIntegerKeys) are quoted first.
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.
A value from an answer quoted for an error message, the base URL's credentials scrubbed
first, before it is cleaned and cut (serverTextForMessage, then MAX_QUOTED_LENGTH, 200
characters): a 2xx answer (an error document with a success status, a /version body) can
echo them as well as an error body, and a cut before the scrub left a prefix of the password.
The client quotes server values with this.
Perform a request with Accept negotiation and transient-error retries.
EngineOptions.bigIntegerKeys, copied.