Browse Source
fix 主动调用 axioscancelToken 的 cancel 取消请求时 无效的问题 (#2586)
cancelToken 如果被深拷贝,会导致最外层无法使用cancel方法来取消请求
pull/2589/head
tttleon
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
0 deletions
-
src/utils/http/axios/Axios.ts
|
|
@ -193,6 +193,11 @@ export class VAxios { |
|
|
|
|
|
|
|
|
request<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> { |
|
|
request<T = any>(config: AxiosRequestConfig, options?: RequestOptions): Promise<T> { |
|
|
let conf: CreateAxiosOptions = cloneDeep(config); |
|
|
let conf: CreateAxiosOptions = cloneDeep(config); |
|
|
|
|
|
// cancelToken 如果被深拷贝,会导致最外层无法使用cancel方法来取消请求
|
|
|
|
|
|
if(config.cancelToken){ |
|
|
|
|
|
conf.cancelToken = config.cancelToken |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
const transform = this.getTransform(); |
|
|
const transform = this.getTransform(); |
|
|
|
|
|
|
|
|
const { requestOptions } = this.options; |
|
|
const { requestOptions } = this.options; |
|
|
|