helpers/jrh_axios

Collection of helper functions for use with the nodejs axios module which does web posts/gets

Source:
Author:

Methods

(inner) calcAxiosOptions()

Source:

Internal function we use when performing axios requests. Currently we use this to bypass https errors on bad certificates

Returns:

an object which options for Axios get/post

(async, inner) getCatchError(url)

Source:

Perform a get and just wrap the axios get to catch errors and embed error in response data

Parameters:
Name Type Description
url string
Returns:

response

(async, inner) postAxiosGetResponseDataCatchError(url, postData)

Source:

Post to the url and get the response. Importantly, while axios throws errors when it gets a 403, 401, etc., we do not -- instead we catch the error and embed it in the {data.error} field of the response

Parameters:
Name Type Description
url string

url to post to

postData object

data to post

Returns:

the response object