Construct an HTTPClient from a BaseHTTPClient
the BaseHTTPClient used
Construct an HTTPClient from a URL (baseServer+port) and a token
Optional port: string | numberOptional defaultHeaders: Record<string, string>Private bcSend a DELETE request. If no content-type present, adds the header "content-type: application/json" and data is serialized in JSON (if not empty)
Send a GET request.
Response object.
The path of the request.
Optional query: Query<any>An object containing the query parameters of the request.
An object containing additional request headers to use.
Options object to use to decode JSON responses. See utils.parseJSON for the options available.
Send a POST request. If no content-type present, adds the header "content-type: application/json" and data is serialized in JSON (if not empty)
Optional query: Query<any>Static parseJSONParse JSON using either the built-in JSON.parse or utils.parseJSON depending on whether jsonOptions are provided or not
JSON data
Status of the response (used in case parseJSON fails)
Options object to use to decode JSON responses. See utils.parseJSON for the options available.
Static Private prepareConvert a BaseHTTPClientResponse into a full HTTPClientResponse Parse the body in Modifies in place res and return the result
Static Private prepareStatic Private serializePrivate
Serialize the data according to the requestHeaders Assumes that requestHeaders contain a key "content-type" If the content-type is "application/json", data is JSON serialized Otherwise, data needs to be either an UTF-8 string that is converted to an Uint8Array or an Uint8Array
Generated using TypeDoc
HTTPClient is a wrapper around a BaseHTTPClient It takes care of setting the proper "Accept" header and of decoding the JSON outputs.