Parameter | Type | Description |
---|---|---|
method | string | Request method (e.g. 'POST'). Must be uppercase. |
url | string / HTTP URL | Request URL (e.g. 'http://example.com'). |
body (optional) | string / object / ArrayBuffer | Request body. Objects will be x-www-form-urlencoded encoded. |
params (optional) | object | Params object containing additional request parameters. |
Returns
Type | Description |
---|---|
Promise with Response | HTTP Response object. |
Examples
Using http.asyncRequest() to issue a POST request:
Using http.asyncRequest() to issue multiple requests, then Promise.race to determine which requests finish first: