Skip to content

Instantly share code, notes, and snippets.

@marcolink
Last active July 18, 2023 14:09
Show Gist options
  • Save marcolink/95fbc19769e0614e215168ab26407ad3 to your computer and use it in GitHub Desktop.
Save marcolink/95fbc19769e0614e215168ab26407ad3 to your computer and use it in GitHub Desktop.
axios migration guide 0.xx to 1.x

axios migration guide 0.x to 1.x

at the time writing this, the latest version was 1.4.0.

Resources

Request Interceptors

The provided type for request intercetptor functions changed:

- AxiosRequestConfig
+ InternalAxiosRequestConfig

This also changes the type of config.headers to AxiosRequestHeaders (which is an axios internal Headers object).

axiosInstance.interceptors.request.use(function (config) {
-  config.headers['Authorization'] = 'Bearer xxx';
+  config.headers.set('Authorization', 'Bearer xxx')
  return config
})

axios proxy (postman)

When using postman to intercept axios requests, the proxy HAS to be defined as http

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment