fix: update Axios.ts (#492)

1. 应该使用传递进来的 请求头
2. 针对有数组类型的参数,应该用brackets 或者 repeat 。  最好将arrayFormat参数改成可以让使用者通过入参来改的。  参考: https://blog.csdn.net/pifutan/article/details/86320705
This commit is contained in:
最后 2021-04-17 22:30:53 +08:00 committed by GitHub
parent 0649011eba
commit e1b30a5075
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 {
return { return {
...config, ...config,
data: qs.stringify(config.data), data: qs.stringify(config.data, { arrayFormat: 'brackets' }),
}; };
} }