Class: HttpClient

HttpClient

Handle HTTP requests with a uniform interface.

Methods

(static) digestAuthRequest()

Modification of digest auth request by @inorganik. Dependent on CryptoJS MD5 hashing: http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/md5.js MIT licensed.
Source:

(async, static) request(request) → {object|string|object|Uint8Array|number|String|object}

Make a HTTP request.

Parameters:
Name Type Description
request object configures the request to make
Properties
Name Type Description
method string HTTP method ("GET", "PUT", "POST", "DELETE", etc)
uri string uri to request
body string | object | Uint8Array request body
username string username to authenticate the request (optional)
password string password to authenticate the request (optional)
headers object headers to add to the request (optional)
requestApi string one of "fetch" or "xhr" (default "fetch")
resolveWithFullResponse boolean return full response if true, else body only (default false)
rejectUnauthorized boolean whether or not to reject self-signed certificates (default true)
timeout number maximum time allowed in milliseconds
proxyToWorker number proxy request to worker thread
Source:
Returns:
  • response - the response object
    Type
    object
  • response.body - the response body
    Type
    string | object | Uint8Array
  • response.statusCode - the response code
    Type
    number
  • response.statusText - the response message
    Type
    String
  • response.headers - the response headers
    Type
    object