agraboso / agraboso/redux-api-middleware

how to send multipart/form-data

未关闭
#125 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
JavaScript
星标
1.5k
派生
190
PR 合并指标
30 天内没有已合并 PR

描述

I'm trying to send file selected by the react-dropzone but I couldn't accomplish this. In some cases call_api is doing nothing no request / no error and in some cases request is sent but without mutlipart info and my server throws exception
` the request was rejected because no multipart boundary was found]`

the code which I think is correct with your documentation is bellow
`
let test = (files) => {

let formData = new FormData();
formData.append('file', files[0]);

return {
[CALL_API]: {
types: [UPLOAD_BEGIN, UPLOAD_SUCCESS, UPLOAD_FAILURE],
endpoint: '/report/RIF/definition',
method: 'post',
headers: {'Content-Type': 'multipart/form-data'},
body: formData
},
}

};`

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。