Switch HTTP client from request to axios
Since the request
package is no longer receiving updates, wait-on switched to using axios
. Attempt to keep the same wait-on options as much as possible.
These breaking changes occurred in the switch:
- There is only one option for redirects
followRedirect: true|false
(defaults to true). httpSignature
is not implemented in axios and now not available. (If this feature is still desired, please help by providing a pull request to implement it.)auth
allows onlyusername
andpassword
but not the previous aliasesuser
andpass
add optional validateStatus fn property
If validateStatus
property is provided in the
config and set to a function, it will use this to
validate whether a status is valid.
The default validateStatus if not provided is
validateStatus: function (status) {
return status >= 200 && status < 300;
}
To also allow a 401 unauthorized as a valid status
validateStatus: function (status) {
return status === 401 || (status >= 200 && status < 300);
}