Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不支持FormaData+file #4

Open
pinksmallpig opened this issue Apr 8, 2021 · 3 comments
Open

不支持FormaData+file #4

pinksmallpig opened this issue Apr 8, 2021 · 3 comments

Comments

@pinksmallpig
Copy link

如果参数是FormData且里面带文件参数就不行了

@H-Dynamite
Copy link

如果参数是FormData且里面带文件参数就不行了

我也碰见了,用原生axios的解决了。

@2194301787
Copy link

源码中index.ts 入口
const allParams = Object.assign({}, this.defaultConfig.defaultParams, params) 导致formdata被损毁
后面判断的时候加上一句
if (contentType === ContentType.form) { requestConfig.data = qs.stringify(allParams) } else if (contentType === ContentType.multipart) { requestConfig.data = params }

@RainManGO
Copy link
Owner

这个是axios 的上层简单封装,主要为了常规接口模型转换问题,上传文件一般是不需要返回模型的,没考虑。直接用axios 吧。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants