REACT JS Error: 501 Not implemented issue while uploading csv file
REACT JS Error: 501 Not implemented issue while uploading csv file
我遇到了这些错误:
POST http://localhost:4000/api/v1/upload/csv-order-upload/single net::ERR_ABORTED 501(未实现)
我正在使用这些代码:
让headers = {'Content-Type': 'multipart/form-data;'};
headers["Authorization"] = `Bearer $(token)`;
const formData = new FormData();
formData.append(
"csv",
this.state.selectedFile,
this.state.selectedFile.name
);
const parameters = {
method: "POST",
headers: headers,
body: formData,
};
fetch('http://localhost:4000/api/v1/upload/csv-order-upload/single',
parameters)
.then((response) => {
console.log("reactNativeDemo", "response get details:" + response);
})
.catch((error) => {
console.log("axios error:", error);
});
};
在后端添加了 'application/vnd.ms-excel' 到 mimetype
在 React 前端中,在调用 API
之前删除了 content-type
添加了以下代码:
删除headers["Content-Type"];
参数 = {
方法:“POST”,
headers: headers,
body:价值观,
};
我遇到了这些错误:
POST http://localhost:4000/api/v1/upload/csv-order-upload/single net::ERR_ABORTED 501(未实现)
我正在使用这些代码:
让headers = {'Content-Type': 'multipart/form-data;'};
headers["Authorization"] = `Bearer $(token)`;
const formData = new FormData();
formData.append(
"csv",
this.state.selectedFile,
this.state.selectedFile.name
);
const parameters = {
method: "POST",
headers: headers,
body: formData,
};
fetch('http://localhost:4000/api/v1/upload/csv-order-upload/single',
parameters)
.then((response) => {
console.log("reactNativeDemo", "response get details:" + response);
})
.catch((error) => {
console.log("axios error:", error);
});
};
在后端添加了 'application/vnd.ms-excel' 到 mimetype
在 React 前端中,在调用 API
之前删除了 content-type添加了以下代码:
删除headers["Content-Type"]; 参数 = { 方法:“POST”, headers: headers, body:价值观, };