Upgrading axios 0.26 to 0.27
Breaking0.26.1 → 0.27.2Breaking5New1Changed1Fixed7Other2
BreakingUpgrade verdict
5 breaking changes.
In plain terms
- Removed functionality that removed the the Content-Type request header when passing FormData.
- New toFormData helper function that allows the implementor to pass an object and allow axios to convert it to FormData.
- **(*)** Refactored error handling implementing AxiosError as a constructor, this is a large change to error handling on the whole.
- Separated responsibility for FormData instantiation between transformRequest and toFormData.
Must act Top 3 of 5 that need code or config changes
Adds form-data ^4.0.0.
Installs 24 packages in all (was 1).
What you must change
Breaking5
Removed functionality that removed the the Content-Type request header when passing FormData.
Content-TypeNew toFormData helper function that allows the implementor to pass an object and allow axios to convert it to FormData.
**(*)** Refactored error handling implementing AxiosError as a constructor, this is a large change to error handling on the whole.
Separated responsibility for FormData instantiation between transformRequest and toFormData.
transformRequesttoFormData**(*)** Improved and fixed multiple issues with FormData support.
API changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- removed:
interface AxiosError<T = any, D = any> extends Error - changed:
method AxiosInterceptorManager.use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any): number → method AxiosInterceptorManager.use<T = V>(onFulfilled?: (value: V) => T | Promise<T>, onRejected?: (error: any) => any, options?: AxiosInterceptorOptions): number - changed:
property AxiosRequestConfig.method?: Method → property AxiosRequestConfig.method?: Method | string - added:
class AxiosError<T = unknown, D = any> extends Error - added:
class CanceledError<T> extends AxiosError<T> - added:
constructor AxiosError(message?: string, code?: string, config?: AxiosRequestConfig<D>, request?: any, response?: AxiosResponse<T, D>) - added:
interface AxiosInterceptorOptions - added:
method Axios.patchForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R> - added:
method Axios.postForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R> - added:
method Axios.putForm<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>): Promise<R> - added:
property AxiosError.status?: string - added:
property AxiosInterceptorOptions.runWhen?: (config: AxiosRequestConfig) => boolean - added:
property AxiosInterceptorOptions.synchronous?: boolean - added:
property AxiosRequestConfig.beforeRedirect?: (options: Record<string, any>, responseDetails: { headers: Record<string, string> }) => void - added:
property AxiosRequestConfig.env?: { FormData?: new (...args: any[]) => object } - added:
static readonly property AxiosError.ECONNABORTED = 'ECONNABORTED' - added:
static readonly property AxiosError.ERR_BAD_OPTION = 'ERR_BAD_OPTION' - added:
static readonly property AxiosError.ERR_BAD_OPTION_VALUE = 'ERR_BAD_OPTION_VALUE' - added:
static readonly property AxiosError.ERR_BAD_REQUEST = 'ERR_BAD_REQUEST' - added:
static readonly property AxiosError.ERR_BAD_RESPONSE = 'ERR_BAD_RESPONSE' - added:
static readonly property AxiosError.ERR_CANCELED = 'ERR_CANCELED' - added:
static readonly property AxiosError.ERR_DEPRECATED = 'ERR_DEPRECATED' - added:
static readonly property AxiosError.ERR_FR_TOO_MANY_REDIRECTS = 'ERR_FR_TOO_MANY_REDIRECTS' - added:
static readonly property AxiosError.ERR_NETWORK = 'ERR_NETWORK' - added:
static readonly property AxiosError.ETIMEDOUT = 'ETIMEDOUT'