Vigia

将 axios 从 0.x 升级到 1.x

根据 TypeScript 类型自动比较 axios 0.34.0 与 1.20.0 的公开 API。签名变化表示可能存在不兼容变更,并非确定结论。

概要

已删除的导入路径0
已删除的导出0
已修改的签名7
已删除的类或接口成员6
已修改的类或接口成员107
新增弃用0
要求变化(engines、peer 依赖)0
新增导出22

已删除的导出

未发现。

已修改的签名

export之前之后
axios · Method"get" | "GET" | "delete" | "DELETE" | "head" | "HEAD" | "options" | "OPTIONS" | "post" | "POST" | "put" | "PUT" | "patch" | "PATCH" | "purge" | "PURGE" | "link" | "LINK" | "unlink" | "UNLINK""GET" | "DELETE" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "PATCH" | "PURGE" | "LINK" | "UNLINK" | "QUERY" | "get" | "delete" | "head" | "options" | "post" | "put" | "patch" | "purge" | "link" | "unlink" | "query"
axios · default<T = any, R = AxiosResponse<T, any>, D = any>(config: AxiosRequestConfig<D>): Promise<R> | <T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(config: AxiosRequestConfig<D, P>): Promise<AxiosResponseResult<T, R, D, P>> | <T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
axios · AxiosPromisePromise<AxiosResponse<T, any>>Promise<AxiosResponse<T, D, {}, P>>
axios · ResponseType"arraybuffer" | "blob" | "document" | "json" | "text" | "stream""arraybuffer" | "blob" | "document" | "json" | "text" | "stream" | "formdata"
axios · responseEncoding"ascii" | "ASCII" | "ansi" | "ANSI" | "binary" | "BINARY" | "base64" | "BASE64" | "base64url" | "BASE64URL" | "hex" | "HEX" | "latin1" | "LATIN1" | "ucs-2" | "UCS-2" | "ucs2" | "UCS2" | "utf-8" | "UTF-8" | "utf8" | "UTF8" | "utf16le" | "UTF16LE""ASCII" | "ANSI" | "BINARY" | "BASE64" | "BASE64URL" | "HEX" | "LATIN1" | "UCS-2" | "UCS2" | "UTF-8" | "UTF8" | "UTF16LE" | "ascii" | "ansi" | "binary" | "base64" | "base64url" | "hex" | "latin1" | "ucs-2" | "ucs2" | "utf-8" | "utf8" | "utf16le"
axios · AxiosRequestHeaders{ [x: string]: HeaderValue | Record<string, HeaderValue> | undefined; get?: AxiosHeaders | undefined; delete?: AxiosHeaders | undefined; head?: AxiosHeaders | undefined; options?: AxiosHeaders | undefined; post?: AxiosHeaders | undefined; put?: AxiosHeaders | undefined; patch?: AxiosHeaders | undefined; purge?: AxiosHeaders | undefined; link?: AxiosHeaders | undefined; unlink?: AxiosHeaders | undefined; common?: AxiosHeaders | undefined; }Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> & AxiosHeaders
axios · AxiosResponseHeadersPartial<Record<string, string>> & { "set-cookie"?: string[] | undefined; }Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; "Content-Type": AxiosHeaderValue; Server: AxiosHeaderValue; "Cache-Control": AxiosHeaderValue; "content-length": AxiosHeaderValue; "content-encoding": AxiosHeaderValue; "content-type": AxiosHeaderValue; server: AxiosHeaderValue; "cache-control": AxiosHeaderValue; } & { 'set-cookie': string[]; }> & AxiosHeaders

已删除的类或接口成员

memberimport之前
Cancel.reasonaxiosunknown
AxiosDefaults.captureCallerStackaxiosboolean | undefined
CanceledError.reasonaxiosunknown
AxiosRequestConfig.captureCallerStackaxiosboolean | undefined
GenericAbortSignal.reasonaxiosunknown
CreateAxiosDefaults.captureCallerStackaxiosboolean | undefined

已修改的类或接口成员

member之前之后
Axios.get<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.put<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.head<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.post<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.patch<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.delete<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.getUri(config?: AxiosRequestConfig<any> | undefined): string(config?: AxiosRequestConfig<any, any> | undefined): string
Axios.options<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.putForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.request<T = any, R = AxiosResponse<T, any>, D = any>(config: AxiosRequestConfig<D>): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(config: AxiosRequestConfig<D, P>): Promise<AxiosResponseResult<T, R, D, P>>
Axios.defaultsAxiosDefaults<any>AxiosDefaults<any, any>
Axios.postForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.patchForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
Axios.constructor(config?: AxiosRequestConfig<any> | undefined): Axios(config?: AxiosRequestConfig<any, any> | undefined): Axios
Axios.interceptors{ request: AxiosInterceptorManager<AxiosRequestConfig<any>>; response: AxiosInterceptorManager<AxiosResponse<any, any>>; }{ request: AxiosInterceptorManager<InternalAxiosRequestConfig<any, any>>; response: AxiosInterceptorManager<AxiosResponse<any, any, {}, any>>; }
AxiosError.configAxiosRequestConfig<D> | undefinedInternalAxiosRequestConfig<D, P> | undefined
AxiosError.responseAxiosResponse<T, D> | undefinedAxiosResponse<T, D, {}, P> | undefined
AxiosError.constructor<T = unknown, D = any>(message?: string | undefined, code?: string | undefined, config?: AxiosRequestConfig<D> | undefined, request?: any, response?: AxiosResponse<T, D> | undefined): AxiosError<T, D><T = unknown, D = any, P = any>(message?: string | undefined, code?: string | undefined, config?: InternalAxiosRequestConfig<D, P> | undefined, request?: any, response?: AxiosResponse<T, D, {}, P> | undefined): AxiosError<T, D, P>
AxiosStatic.get<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.put<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.head<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.post<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.patch<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.CancelCancelStatictypeof CanceledError
AxiosStatic.create(config?: CreateAxiosDefaults<any> | undefined): AxiosInstance(config?: CreateAxiosDefaults<any, any> | undefined): AxiosInstance
AxiosStatic.delete<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.getUri(config?: AxiosRequestConfig<any> | undefined): string(config?: AxiosRequestConfig<any, any> | undefined): string
AxiosStatic.options<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.putForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.request<T = any, R = AxiosResponse<T, any>, D = any>(config: AxiosRequestConfig<D>): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(config: AxiosRequestConfig<D, P>): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.defaultsOmit<AxiosDefaults<any>, "headers"> & { headers: HeadersDefaults & { [key: string]: string | number | boolean | undefined; }; }Omit<AxiosDefaults<any, any>, "headers"> & { headers: HeadersDefaults & { [key: string]: AxiosHeaderValue; }; }
AxiosStatic.isCancel(value: any): value is Cancel<T = any, D = any, P = any>(value: any): value is CanceledError<T, D, P>
AxiosStatic.postForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.patchForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosStatic.interceptors{ request: AxiosInterceptorManager<AxiosRequestConfig<any>>; response: AxiosInterceptorManager<AxiosResponse<any, any>>; }{ request: AxiosInterceptorManager<InternalAxiosRequestConfig<any, any>>; response: AxiosInterceptorManager<AxiosResponse<any, any, {}, any>>; }
AxiosStatic.isAxiosError<T = any, D = any>(payload: any): payload is AxiosError<T, D><T = any, D = any, P = any>(payload: any): payload is AxiosError<T, D, P>
AxiosDefaults.env{ FormData?: (new (...args: any[]) => object) | undefined; } | undefined{ FormData?: (new (...args: any[]) => object) | undefined; fetch?: ((input: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>) | undefined; Request?: (new (input: string | URL | Request, init?: RequestInit | undefined) => Request) | undefined; Response?: (new (body?: strin…
AxiosDefaults.methodstring | undefinedStringLiteralsOrString<Method> | undefined
AxiosDefaults.paramsanyP | undefined
AxiosDefaults.adapterAxiosAdapter | undefinedAxiosAdapterConfig | AxiosAdapterConfig[] | undefined
AxiosDefaults.withXSRFTokenboolean | ((config: AxiosRequestConfig<any>) => boolean | undefined) | undefinedboolean | ((config: InternalAxiosRequestConfig<D, P>) => boolean | undefined) | undefined
AxiosDefaults.beforeRedirect((options: Record<string, any>, responseDetails: { headers: Record<string, string>; }) => void) | undefined((options: Record<string, any>, responseDetails: { headers: Record<string, string>; statusCode: HttpStatusCode; }, requestDetails: { headers: Record<string, string>; url: string; method: string; }) => void) | undefined
AxiosDefaults.onUploadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
AxiosDefaults.paramsSerializerCustomParamsSerializer | ParamsSerializerOptions | undefinedParamsSerializerOptions<unknown extends P ? Record<string, any> : P> | CustomParamsSerializer<unknown extends P ? Record<string, any> : P> | undefined
AxiosDefaults.responseEncodingstring | undefinedStringLiteralsOrString<responseEncoding> | undefined
AxiosDefaults.onDownloadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
AxiosInstance.get<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.put<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.head<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.post<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.patch<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.delete<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.getUri(config?: AxiosRequestConfig<any> | undefined): string(config?: AxiosRequestConfig<any, any> | undefined): string
AxiosInstance.options<T = any, R = AxiosResponse<T, any>, D = any>(url: string, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.putForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.request<T = any, R = AxiosResponse<T, any>, D = any>(config: AxiosRequestConfig<D>): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(config: AxiosRequestConfig<D, P>): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.defaultsOmit<AxiosDefaults<any>, "headers"> & { headers: HeadersDefaults & { [key: string]: string | number | boolean | undefined; }; }Omit<AxiosDefaults<any, any>, "headers"> & { headers: HeadersDefaults & { [key: string]: AxiosHeaderValue; }; }
AxiosInstance.postForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.patchForm<T = any, R = AxiosResponse<T, any>, D = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D> | undefined): Promise<R><T = any, R = typeof axiosResponseDefault, D = any, P = any>(url: string, data?: D | undefined, config?: AxiosRequestConfig<D, P> | undefined): Promise<AxiosResponseResult<T, R, D, P>>
AxiosInstance.interceptors{ request: AxiosInterceptorManager<AxiosRequestConfig<any>>; response: AxiosInterceptorManager<AxiosResponse<any, any>>; }{ request: AxiosInterceptorManager<InternalAxiosRequestConfig<any, any>>; response: AxiosInterceptorManager<AxiosResponse<any, any, {}, any>>; }
AxiosResponse.configAxiosRequestConfig<D>InternalAxiosRequestConfig<D, P>
AxiosResponse.headersAxiosResponseHeadersAxiosResponseHeaders | (H & Partial<RawAxiosHeaders & { "Content-Length": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; "Content-Type": AxiosHeaderValue; Server: AxiosHeaderValue; "Cache-Control": AxiosHeaderValue; "content-length": AxiosHeaderValue; "content-encoding": AxiosHeaderValue; "…
CanceledError.namestring"CanceledError"
CanceledError.configAxiosRequestConfig<any> | undefinedInternalAxiosRequestConfig<D, P> | undefined
CanceledError.responseAxiosResponse<T, any> | undefinedAxiosResponse<T, D, {}, P> | undefined
CanceledError.constructor<T>(message?: string | undefined, code?: string | undefined, config?: AxiosRequestConfig<any> | undefined, request?: any, response?: AxiosResponse<T, any> | undefined): CanceledError<T><T, D = any, P = any>(message?: string | undefined, config?: InternalAxiosRequestConfig<D, P> | undefined, request?: any): CanceledError<T, D, P>
HeadersDefaults.getPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.putPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.headPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.linkPartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | undefinedPartial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> | undefined
HeadersDefaults.postPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.patchPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.purgePartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | undefinedPartial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> | undefined
HeadersDefaults.commonPartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.deletePartial<AxiosHeaders & MethodsHeaders & CommonHeaders>Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }>
HeadersDefaults.unlinkPartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | undefinedPartial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> | undefined
HeadersDefaults.optionsPartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | undefinedPartial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> | undefined
AxiosProxyConfig.auth{ username: string; password: string; } | undefinedAxiosBasicCredentials | undefined
CancelTokenSource.cancel(message?: string | undefined, config?: AxiosRequestConfig<any> | undefined, request?: any): void(message?: string | undefined, config?: AxiosRequestConfig<any, any> | undefined, request?: any): void
AxiosRequestConfig.env{ FormData?: (new (...args: any[]) => object) | undefined; } | undefined{ FormData?: (new (...args: any[]) => object) | undefined; fetch?: ((input: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>) | undefined; Request?: (new (input: string | URL | Request, init?: RequestInit | undefined) => Request) | undefined; Response?: (new (body?: strin…
AxiosRequestConfig.methodstring | undefinedStringLiteralsOrString<Method> | undefined
AxiosRequestConfig.paramsanyP | undefined
AxiosRequestConfig.adapterAxiosAdapter | undefinedAxiosAdapterConfig | AxiosAdapterConfig[] | undefined
AxiosRequestConfig.headersPartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | undefinedAxiosHeaders | (Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> & Partial<{ get: AxiosHea…
AxiosRequestConfig.withXSRFTokenboolean | ((config: AxiosRequestConfig<any>) => boolean | undefined) | undefinedboolean | ((config: InternalAxiosRequestConfig<D, P>) => boolean | undefined) | undefined
AxiosRequestConfig.beforeRedirect((options: Record<string, any>, responseDetails: { headers: Record<string, string>; }) => void) | undefined((options: Record<string, any>, responseDetails: { headers: Record<string, string>; statusCode: HttpStatusCode; }, requestDetails: { headers: Record<string, string>; url: string; method: string; }) => void) | undefined
AxiosRequestConfig.onUploadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
AxiosRequestConfig.paramsSerializerCustomParamsSerializer | ParamsSerializerOptions | undefinedParamsSerializerOptions<unknown extends P ? Record<string, any> : P> | CustomParamsSerializer<unknown extends P ? Record<string, any> : P> | undefined
AxiosRequestConfig.responseEncodingstring | undefinedStringLiteralsOrString<responseEncoding> | undefined
AxiosRequestConfig.onDownloadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
GenericAbortSignal.onabort((...args: any) => any) | null((...args: any) => any) | null | undefined
GenericAbortSignal.addEventListener(...args: any): any((...args: any) => any) | undefined
GenericAbortSignal.removeEventListener(...args: any): any((...args: any) => any) | undefined
CreateAxiosDefaults.env{ FormData?: (new (...args: any[]) => object) | undefined; } | undefined{ FormData?: (new (...args: any[]) => object) | undefined; fetch?: ((input: string | URL | Request, init?: RequestInit | undefined) => Promise<Response>) | undefined; Request?: (new (input: string | URL | Request, init?: RequestInit | undefined) => Request) | undefined; Response?: (new (body?: strin…
CreateAxiosDefaults.methodstring | undefinedStringLiteralsOrString<Method> | undefined
CreateAxiosDefaults.paramsanyP | undefined
CreateAxiosDefaults.adapterAxiosAdapter | undefinedAxiosAdapterConfig | AxiosAdapterConfig[] | undefined
CreateAxiosDefaults.headersPartial<AxiosHeaders & MethodsHeaders & CommonHeaders> | Partial<HeadersDefaults> | undefinedAxiosHeaders | Partial<RawAxiosHeaders & { Accept: AxiosHeaderValue; "Content-Length": AxiosHeaderValue; "User-Agent": AxiosHeaderValue; "Content-Encoding": AxiosHeaderValue; Authorization: AxiosHeaderValue; Location: AxiosHeaderValue; } & { 'Content-Type': ContentType; }> | Partial<HeadersDefaults>…
CreateAxiosDefaults.withXSRFTokenboolean | ((config: AxiosRequestConfig<any>) => boolean | undefined) | undefinedboolean | ((config: InternalAxiosRequestConfig<D, P>) => boolean | undefined) | undefined
CreateAxiosDefaults.beforeRedirect((options: Record<string, any>, responseDetails: { headers: Record<string, string>; }) => void) | undefined((options: Record<string, any>, responseDetails: { headers: Record<string, string>; statusCode: HttpStatusCode; }, requestDetails: { headers: Record<string, string>; url: string; method: string; }) => void) | undefined
CreateAxiosDefaults.onUploadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
CreateAxiosDefaults.paramsSerializerCustomParamsSerializer | ParamsSerializerOptions | undefinedParamsSerializerOptions<unknown extends P ? Record<string, any> : P> | CustomParamsSerializer<unknown extends P ? Record<string, any> : P> | undefined
CreateAxiosDefaults.responseEncodingstring | undefinedStringLiteralsOrString<responseEncoding> | undefined
CreateAxiosDefaults.onDownloadProgress((progressEvent: ProgressEvent<EventTarget>) => void) | undefined((progressEvent: AxiosProgressEvent) => void) | undefined
AxiosInterceptorManager.use<T = V>(onFulfilled?: ((value: V) => T | Promise<T>) | undefined, onRejected?: ((error: any) => any) | undefined, options?: AxiosInterceptorOptions | undefined): number(onFulfilled?: AxiosInterceptorFulfilled<V> | null | undefined, onRejected?: AxiosInterceptorRejected | null | undefined): number | (onFulfilled?: AxiosInterceptorFulfilled<V> | null | undefined, onRejected?: AxiosInterceptorRejected | null | undefined, options?: AxiosInterceptorOptions | undefined)…
AxiosInterceptorOptions.runWhen((config: AxiosRequestConfig<any>) => boolean) | undefined((config: InternalAxiosRequestConfig<any, any>) => boolean) | null | undefined
ParamsSerializerOptions.serializeCustomParamsSerializer | undefinedCustomParamsSerializer<P> | undefined

新增弃用

未发现。

要求变化(engines、peer 依赖)

未发现。

新增导出 (22)
importexportkind
axiosallfunction
axioscreatefunction
axiosspreadfunction
axiosisCancelfunction
axiosformToJSONfunction
axiosgetAdapterfunction
axiostoFormDatafunction
axiosmergeConfigfunction
axiosAxiosHeadersclass
axiosisAxiosErrorfunction
axiosAddressFamilytype
axiosLookupAddresstype
axiosHttpStatusCodeenum
axiosRawAxiosHeadersinterface
axiosAxiosHeaderValuetype
axiosAxiosProgressEventinterface
axiosLookupAddressEntryinterface
axiosAxiosHeaderParameterstype
axiosRawAxiosRequestConfigtype
axiosRawAxiosRequestHeaderstype
axiosRawAxiosResponseHeaderstype
axiosInternalAxiosRequestConfiginterface

这些版本之间的 changelog

软件包作者发布的文本,按原样显示。

1.19.0
This release raises the form-data security floor, adds configuration and type-system capabilities, and fixes NO_PROXY matching, interceptor errors, progress reporting, and serialization edge cases.

## 🔒 Security Fixes

- Multipart Form Data: Raised the form-data dependency floor to ^4.0.6, preventing fresh installations from resolving versions affected by the CRLF injection vulnerability GHSA-hmw2-7cc7-3qxx (https://github.com/advisories/GHSA-hmw2-7cc7-3qxx). (#11028)

## 🚀 New Features

- Configuration Extensibility: Preserved own-enumerable symbol-keyed fields through mergeConfig and added a generic params type across public TypeScript declarations, responses, errors,
  adapters, and serializers. (#11043, #11081)
- Header Parameter Parsing: Added the opt-in AxiosHeaders.parseParameters() parser for quote-aware, RFC-style HTTP parameter parsing while preserving legacy parsing behavior. (#11051)
- HTTP Status Codes: Added the missing Cloudflare 520 WebServerReturnsAnUnknownError status and matching ESM/CJS declarations. (#11067)

## 🐛 Bug Fixes

- Form Data Conversion: Limited formDataToJSON path splitting to dot and bracket notation, preserving literal punctuation in keys, and removed browser-facing Buffer.from usage from toFormData to avoid unnecessary polyfills. (#11006, #11018)
- Proxy Bypass: Canonicalized IPv4 shorthand, octal, and hexadecimal forms during NO_PROXY matching and honored * entries within comma- or space-separated bypass lists. (#11029, #11053)
- Cancellation: Propagated already-aborted input signals immediately when composing abort signals. (#11035)
- Header Handling: Preserved empty first values for duplicate singleton headers and made AxiosHeaders#getSetCookie() consistently return arrays for present values. (#11036, #11037)
- URL Handling: Included normalized, safely redacted offending URLs in malformed-protocol errors and removed repeated trailing slashes when combining base URLs. (#11008, #11038)

- Progress Events: Clamped malformed negative progress values to zero and ensured final Node.js download progress events are delivered before streamed responses close. (#11039, #11040)
- Error and JSON Serialization: Serialized Set values as arrays in JSON-compatible snapshots and synthesized useful AxiosError messages from otherwise-empty AggregateError instances. (#11044, #11059)
- Content-Length Enforcement: Corrected base64 data: URL size estimation so maxContentLength is enforced consistently by the HTTP and Fetch adapters. (#11061)
- Synchronous Interceptors: Prevented requests from being dispatched after synchronous request interceptors fail unless their paired rejection handler resolves successfully. (#11071)

## 🔧 Maintenance & Chores

- Dependencies: Updated development and test tooling, the docs fixture's Axios version, and GitHub Actions integrations including Checkout, Setup Node, Setup Deno, and Zizmor. (#11031, #11055, #11056, #11058, #11079, #11080, #11088, #11089, #11090)
- Build Outputs: Limited sourcemap
1.18.0
This release hardens redirect and URL handling, improves the validateStatus configuration semantics, and includes updates to documentation, dependencies, and release metadata.

## 🔒 Security Fixes

* **Redirect Header Safety:** Added Node HTTP adapter support for stripping caller-specified sensitive headers on cross-origin redirects, helping prevent custom auth headers such as API keys from leaking to another origin. (__#10892__)

* **URL And Request Hardening:** Rejects malformed `http:` and `https:` URLs that omit `//` with `ERR_INVALID_URL`, while tightening prototype-pollution-safe config reads, stream size limits, FormData depth handling, data URL sizing, and local `NO_PROXY` matching. (__#11000__)

## 🐛 Bug Fixes

* **Status Validation:** Added `transitional.validateStatusUndefinedResolves` so applications can opt in to treating `validateStatus: undefined` like the option was omitted, while `validateStatus: null` remains the explicit way to accept every status. (__#10899__)

## 🔧 Maintenance & Chores

* **Documentation:** Published the v1.17.0 release notes, fixed a changelog typo, clarified the package update PR policy, and marked the `proxy` request config as Node.js-only in the advanced docs. (__#10984__, __#10988__, __#10992__, __#10995__)

* **Dependencies:** Bumped `@babel/core`, `@babel/preset-env`, `@commitlint/cli`, `@commitlint/config-conventional`, `@rollup/plugin-babel`, `@rollup/plugin-commonjs`, `@vitest/browser`, `@vitest/browser-playwright`, `eslint`, `lint-staged`, `rollup`, `vitest`, and `actions/checkout`. (__#10989__, __#10996__, __#10997__)

* **Release Metadata:** Prepared the 1.18.0 release by updating package metadata and the runtime `VERSION` value. (__#11003__)

## 🌟 New Contributors

We are thrilled to welcome our new contributors. Thank you for helping improve axios:

* __@drori12__ (__#10984__)
* __@eyupcanakman__ (__#10899__)
* __@Adi-Beker__ (__#10995__)

[Full Changelog](https://github.com/axios/axios/compare/v1.17.0...v1.18.0)
1.17.0
This release adds Node HTTP zstd decompression, hardens config and release workflows, and fixes authentication, header, proxy, and type-handling regressions.

## 🔒 Security Fixes

* **Config Hardening:** Guarded `socketPath`, `params`, and `paramsSerializer` reads with own-property checks to prevent inherited prototype values from affecting request behavior, including SSRF-sensitive paths. (__#10901__, __#10922__)
* **Release Publishing:** Switched the publish workflow to npm staged publishing for safer, auditable package releases with provenance. (__#10926__)

## 🚀 New Features

* **HTTP Compression:** Added Node HTTP adapter support for zstd response decompression, with `transitional.advertiseZstdAcceptEncoding` controlling whether `zstd` is advertised in `Accept-Encoding`. (__#6792__, __#10920__)

## 🐛 Bug Fixes

* **Authentication Handling:** Restored Basic auth on same-origin Node redirects while continuing to strip credentials cross-origin, and aligned the fetch adapter with HTTP adapter behavior for URL-embedded Basic auth. (__#10929__, __#10896__)
* **Proxy TLS:** Preserved user `httpsAgent` TLS options when tunneling HTTPS requests through HTTP CONNECT proxies. (__#10957__)
* **React Native FormData:** Cleared default `Content-Type` for React Native `FormData` so multipart boundaries can be generated correctly. (__#10898__)
* **Headers:** Silently skipped empty or whitespace-only header names instead of throwing, matching parsed-header behavior and avoiding React Native response crashes. (__#10875__)
* **Request Data Merging:** Preserved enumerable symbol keys when cloning plain request data through axios merge logic. (__#10812__)
* **Bundler Compatibility:** Converted `resolveConfig` from an arrow default export to a named function export to avoid webpack and Babel transform interop failures. (__#10891__)
* **Types:** Corrected `AxiosHeaders.toJSON()` return types and updated CommonJS `isCancel` typings to narrow to `CanceledError<T>`. (__#10956__, __#10952__)
* **Build Tooling:** Avoided emitting a null `Authorization` header from the GitHub build helper when `GITHUB_TOKEN` is unset. (__#10931__)

## 🔧 Maintenance & Chores

* **HTTP/2 Internals:** Extracted `Http2Sessions` into its own helper module and added direct unit coverage for session pooling, timeout, and cleanup behavior. (__#10861__)
* **Package Publishing:** Reduced published package size by switching to a `files` allowlist and dropping unneeded unminified bundle source maps. (__#10939__)
* **CI and Release Automation:** Added bundle-size reporting, moved reports to the job summary, fixed bundle-size comparison coverage, added Node 26 to the matrix, pinned npm for staged publishing, and prepared the 1.17.0 release. (__#10907__, __#10911__, __#10916__, __#10927__, __#10935__, __#10983__)
* **Developer Workflow:** Added a dev container and iterated on OpenSpec workflow files before removing them from the release branch. (__#10925__, __#10914__, __#10958__)
* **Documentatio
1.16.1
This release ships a defence-in-depth fix for prototype pollution in `formDataToJSON`, hardens proxy and CI workflows, restores Webpack 4 compatibility for the fetch adapter, and includes several small bug fixes and maintenance improvements.

## 🔒 Security Fixes

* **Prototype Pollution Defence-in-Depth:** Hardened `formDataToJSON` against already-polluted `Object.prototype` by walking own properties only, so attacker-controlled keys inherited from a poisoned prototype cannot propagate through deserialization. (__#7413__)
* **Proxy Cleartext Leak:** Fixed an issue where HTTPS request data could be transmitted in cleartext to an HTTP proxy under certain configurations. (__#10858__)
* **CI Cache Removal:** Removed all GitHub Actions caches as a defence-in-depth measure against cache poisoning vectors in the build pipeline. (__#10882__)

## 🐛 Bug Fixes

* **Data URI Parsing:** Updated the `fromDataURI` regex to match RFC 2397 more strictly, fixing edge cases in `data:` URL handling. (__#10829__)
* **Unicode Headers:** Preserved Unicode header values when running through request interceptors, so non-ASCII header content is no longer corrupted before dispatch. (__#10850__)
* **XHR Upload Progress:** Guarded against malformed `ProgressEvent` payloads emitted by some environments during XHR upload, preventing crashes when `loaded` / `total` are missing or invalid. (__#10868__)
* **Webpack 4 Fetch Adapter:** Fixed an "unexpected token" error caused by syntax in the fetch adapter that Webpack 4 could not parse, restoring compatibility for legacy bundler users. (__#10864__)
* **Type Definitions:** Made `parseReviver` `context.source` optional in the type definitions to align with the ES2023 specification. (__#10837__)
* **URL Object Support Reverted:** Reverted the change that allowed passing a `URL` object as `config.url` (originally __#10866__) due to regressions; this support will be reintroduced in a later release once the underlying issues are addressed. (__#10874__)

## 🔧 Maintenance & Chores

* **Cycle Detection Refactor:** Replaced the array-based cycle tracker in `toJSONObject` with a `WeakSet`, improving performance and memory behaviour on large nested structures. (__#10832__)
* **composeSignals Cleanup:** Refactored `composeSignals` to use a clearer early-return structure, simplifying the cancellation/abort composition path. (__#10844__)
* **AI Readiness & Repo Docs:** Added `AGENTS.md` and related contributor-guide updates for both human and AI agents, plus post-release documentation improvements. (__#10835__, __#10841__)
* **Docs Improvements:** Clarified the GET request example, fixed the interceptor `eject` example to reference the correct instance, and corrected the Buzzoid sponsor description in the README. (__#10836__, __#10853__, __#10856__)
* **Sponsorship Tooling:** Fixed empty sponsor arrays in the sponsor processing script, added the ability to inject additional sponsors, updated the sponsorship link, and added a Twicsy advertisem

常见问题

将 axios 从 0 升级到 1 有哪些不兼容变更?

在 axios 0.34.0 与 1.20.0 之间,Vigia 发现 0 个已删除的导出、7 个已修改的签名,以及 113 个已删除或修改的类或接口成员。

axios 1 中弃用了哪些内容?

axios 1.20.0 中有 0 个导出或成员新被标记为弃用。

供智能体使用

GET https://vigia.coredls.cloud/v1/packages/npm/axios/upgrade?from=0.34.0&to=1.20.0