Unverified 提交 e1b30a50 作者: 最后 提交者: GitHub

fix: update Axios.ts (#492)

1. 应该使用传递进来的 请求头
2. 针对有数组类型的参数,应该用brackets 或者 repeat 。  最好将arrayFormat参数改成可以让使用者通过入参来改的。  参考: https://blog.csdn.net/pifutan/article/details/86320705
上级 0649011e
...@@ -155,7 +155,7 @@ export class VAxios { ...@@ -155,7 +155,7 @@ export class VAxios {
// support form-data // support form-data
supportFormData(config: AxiosRequestConfig) { supportFormData(config: AxiosRequestConfig) {
const headers = this.options?.headers; const headers = config.headers;
const contentType = headers?.['Content-Type'] || headers?.['content-type']; const contentType = headers?.['Content-Type'] || headers?.['content-type'];
if ( if (
...@@ -168,7 +168,7 @@ export class VAxios { ...@@ -168,7 +168,7 @@ export class VAxios {
return { return {
...config, ...config,
data: qs.stringify(config.data), data: qs.stringify(config.data, { arrayFormat: 'brackets' }),
}; };
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论