React native 反应本机,使用Axios发布FormData时出现网络错误
我试图通过创建FormData发送音频/图像 我当前的版本是:“react native”:“0.59.10”、“axios”:“^0.19.2”、“react”:“16.8.3”。我正在android设备上测试我的应用程序 发送表单数据时,每次都会出现“网络错误” 以下是我创建和发送帖子的方法React native 反应本机,使用Axios发布FormData时出现网络错误,react-native,axios,react-native-android,React Native,Axios,React Native Android,我试图通过创建FormData发送音频/图像 我当前的版本是:“react native”:“0.59.10”、“axios”:“^0.19.2”、“react”:“16.8.3”。我正在android设备上测试我的应用程序 发送表单数据时,每次都会出现“网络错误” 以下是我创建和发送帖子的方法 let new_options = { headers: { 'Content-Type': 'multipart/form-data', 'Authorizatio
let new_options = {
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': myAuthorization
}
};
const content = new FormData();
content.append('file', {
uri: 'file://' + attachment.path,
name: 'test',
type: attachment.type
});
content.append('ReportId', report_id);
content.append('MimeType', attachment.type);
try {
let res = await axios.post(myUrl, content, new_options);
}catch(err){
console.warn(err);
}
我已经尝试过更新FLIPPER\u版本或编辑react-NativeFlipper.java之类的事情,但这些事情都不存在于我的项目中,因为我使用的是react-native的旧版本。我还试图删除调试文件夹。发现问题是由错误的mimetype引起的