Transport Class
The transport layer that handles communications with the API endpoints.
Item Index
Methods
- doRequest static
- doUnmanagedRequest static
Methods
doRequest
-
opts
-
[body]
-
fn
Do an HTTPS request.
This performs a simple HTTPS request, and then executes the callback, passing the response object into the callback.
Parameters:
-
opts
ObjectAn object containing, at minimum, a parsed URL. To create a new opts, use URL.parse(url).
-
[body]
String optional(Optional) The body of the request.
-
fn
FunctionA callback function. This receives an Error (on error), a Response, and (if present) the data as a string.
doUnmanagedRequest
()
static
Perform an HTTP request, but leave the data processing to something else.
This is useful for requests that result in large payloads, or for any cases where the response returned needs to be streamed to something else.
ObjectStorage is the quintessential use case.
fn(Error e, Stream response);
This will emit an error when the status code is 400 or above, but it does not manage redirects (3XX), 1XX and so on.
IMPORTANT: On errors, the Stream is still passed.