Unverified 提交 4f35b95b 作者: sevth 提交者: GitHub

fix: Multiple calls to createAxios function transform parameters are overwritten…

fix: Multiple calls to createAxios function transform parameters are overwritten by other calls (#1474)
上级 46e28f02
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
// The axios configuration can be changed according to the project, just change the file, other files can be left unchanged // The axios configuration can be changed according to the project, just change the file, other files can be left unchanged
import type { AxiosResponse } from 'axios'; import type { AxiosResponse } from 'axios';
import { clone } from 'lodash-es';
import type { RequestOptions, Result } from '/#/axios'; import type { RequestOptions, Result } from '/#/axios';
import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform'; import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform';
import { VAxios } from './Axios'; import { VAxios } from './Axios';
...@@ -208,7 +209,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) { ...@@ -208,7 +209,7 @@ function createAxios(opt?: Partial<CreateAxiosOptions>) {
// 如果是form-data格式 // 如果是form-data格式
// headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED }, // headers: { 'Content-Type': ContentTypeEnum.FORM_URLENCODED },
// 数据处理方式 // 数据处理方式
transform, transform: clone(transform),
// 配置项,下面的选项都可以在独立的接口请求中覆盖 // 配置项,下面的选项都可以在独立的接口请求中覆盖
requestOptions: { requestOptions: {
// 默认将prefix 添加到url // 默认将prefix 添加到url
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论