I am sending a request from the react to my backend. And from my backend I am already sending a request to another backend(asp .net). I get this error: {"":["Failed to read the requ est form. Missing content-type boundary."]}. All data must be form data
const express = require('express');
const router = express.Router();
const axios = require("axios");
let FormData = require("form-data");
router.post('/proctoring', async (req, res) => {
let form = new FormData();
form.append("TestId", 120521);
const result = await axios("https://dashboard.curs.kz:8023/api/Tests/ProctoringFiles", {
method: "POST",
headers: { 'Authorization': req.headers['authorization'], 'Content-Type': 'multipart/form-data' },
data: JSON.stringify(form)
}).catch(e => console.log(JSON.stringify(e.response.data), "error"));
console.log(result);
});
module.exports = router;
if i remove JSON.stringify it's also will not working
Content-Type': 'multipart/form-data' data: JSON.stringify(form)
To send multipart data:
data
. Do not pass a string.boundary
parameter.To send JSON data:
application/json
)