This commit is contained in:
@@ -170,16 +170,16 @@ export class BaseService {
|
||||
|
||||
if (params) {
|
||||
Object.keys(params).forEach((key) => {
|
||||
formData.append(key, params[key])
|
||||
if (params[key] !== undefined && params[key] !== null && params[key] !== '') {
|
||||
formData.append(key, String(params[key]))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 不要手动设置 Content-Type,让浏览器自动设置(包含正确的 boundary)
|
||||
return request.post<BaseResponse<T>>({
|
||||
url,
|
||||
data: formData,
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
data: formData
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user