Skip to content

v5.0.0 switch http client to axios, add validateStatus

Compare
Choose a tag to compare
@jeffbski jeffbski released this 05 May 01:15
· 87 commits to master since this release

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:

  1. There is only one option for redirects followRedirect: true|false (defaults to true).
  2. 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.)
  3. auth allows only username and password but not the previous aliases user and pass

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);
}