Xhr Class
Provides XHR functionality for use in either a browser or node environment.
Methods
get
(
Promise
-
path endpoint
-
[data]
-
[options={}]
Perform a GET request
Parameters:
-
path endpoint
StringURL
-
[data]
Object | | String optionaldata to send
-
[options={}]
Object optionalOptions
-
[contentType]
String optionalContent type of
data
. Defaults toapplication/json
-
[headers]
Object optionalHeaders to pass with request.
-
[xhr]
Object optionalXMLHttpRequest compatible object to use for XHR requests
-
Returns:
Promise:
A promise that will be fulfilled with JSON xhr.responseText
of the request
post
(
Promise
-
path endpoint
-
[data]
-
[options={}]
Perform a POST request
Parameters:
-
path endpoint
StringURL
-
[data]
Object | | String optionaldata to send
-
[options={}]
Object optionalOptions
-
[contentType]
String optionalContent type of
data
. Defaults toapplication/json
-
[headers]
Object optionalHeaders to pass with request.
-
[xhr]
Object optionalXMLHttpRequest compatible object to use for XHR requests
-
Returns:
Promise:
A promise that will be fulfilled with JSON xhr.responseText
of the request