http/request_hepler
library
Functions
-
convert2GetFormData(Map params, {String fileKey = "file"})
→ FormData?
-
@author:wzp_vicky
@time:2024年11月12日13:43:06
@version: V1
@description 针对上传file MultipartFile的场景
如dio官方所述:https://github.com/cfug/dio/blob/main/dio/README-ZH.md#%E9%80%9A%E8%BF%87-formdata-%E4%B8%8A%E4%BC%A0%E5%A4%9A%E4%B8%AA%E6%96%87%E4%BB%B6
按照他的方法我们可以看见file的content-type和mimetype都是 ---> application/octet-stream
如果后端强制校验了:eg:图片是image/jpeg那直接使用dio官方的方式就不行了,所以这里做一个统一的处理
请注意这个入口方法没有没有按照小程序的分成filePath和formData,考虑到分开可能需要new多个map就算了 且小程序是单个上传 我这个支持多个,就搞成这种吧