Commit e1b30a5075a2a2f9e2c538350950e6e09b6decd1
Committed by
GitHub
1 parent
0649011e
fix: update Axios.ts (#492)
1. 应该使用传递进来的 请求头 2. 针对有数组类型的参数,应该用brackets 或者 repeat 。 最好将arrayFormat参数改成可以让使用者通过入参来改的。 参考: https://blog.csdn.net/pifutan/article/details/86320705
Showing
1 changed file
with
2 additions
and
2 deletions
src/utils/http/axios/Axios.ts
... | ... | @@ -155,7 +155,7 @@ export class VAxios { |
155 | 155 | |
156 | 156 | // support form-data |
157 | 157 | supportFormData(config: AxiosRequestConfig) { |
158 | - const headers = this.options?.headers; | |
158 | + const headers = config.headers; | |
159 | 159 | const contentType = headers?.['Content-Type'] || headers?.['content-type']; |
160 | 160 | |
161 | 161 | if ( |
... | ... | @@ -168,7 +168,7 @@ export class VAxios { |
168 | 168 | |
169 | 169 | return { |
170 | 170 | ...config, |
171 | - data: qs.stringify(config.data), | |
171 | + data: qs.stringify(config.data, { arrayFormat: 'brackets' }), | |
172 | 172 | }; |
173 | 173 | } |
174 | 174 | ... | ... |