V8 Javascript API

http.async Class Reference

[Http Requests]

Description

Asynchronous variants of the http api. The functions take the same request structure as the synchronous version as input and return a Promise. These promises resolve with the results of the requests or reject if any request is invalid.

Note:

Like all other asynchronous functionality any command using these functions must return a Promise.

Static Functions

Promise delete( http.​Request request)
Sends an asynchronous http request with the method set to DELETE by default. More...
Promise get( http.​Request request)
Sends an asynchronous http request with the method set to GET by default. More...
Promise head( http.​Request request)
Sends an asynchronous http request with the method set to HEAD by default. More...
Promise options( http.​Request request)
Sends an asynchronous http request with the method set to OPTIONS by default. More...
Promise patch( http.​Request request)
Sends an asynchronous http request with the method set to PATCH by default. More...
Promise post( http.​Request request)
Sends an asynchronous http request with the method set to POST by default. More...
Promise put( http.​Request request)
Sends an asynchronous http request with the method set to PUT by default. More...
Promise send( http.​Request request)
Sends an asynchronous http request and returns the response. More...

Functions

Promise http.​async.delete( http.​Request request) [static]

Sends an asynchronous http request with the method set to DELETE by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.get( http.​Request request) [static]

Sends an asynchronous http request with the method set to GET by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.head( http.​Request request) [static]

Sends an asynchronous http request with the method set to HEAD by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.options( http.​Request request) [static]

Sends an asynchronous http request with the method set to OPTIONS by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.patch( http.​Request request) [static]

Sends an asynchronous http request with the method set to PATCH by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.post( http.​Request request) [static]

Sends an asynchronous http request with the method set to POST by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.put( http.​Request request) [static]

Sends an asynchronous http request with the method set to PUT by default.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.

Promise http.​async.send( http.​Request request) [static]

Sends an asynchronous http request and returns the response.

Note:

Http codes that could be considered errors such as those in the 4xx or 5xx range are considered valid responses and will return http.Response objects instead of http.Error objects.

Parameters

request
Http request object to send. May be one of the following:
  • http.Request : Request options object.
  • String : Request url to retrieve.
  • Array : Mixed array of String urls and http.Request objects.

Returns

The promise will resolve with an http.Response or http.Error if request is a String or http.Request . In the case that an Array was provided, an Array of http.Request or http.Error objects are resolved. If any request is invalid the promise will reject.