How about using direct axios API?
axios({
method: 'post',
url: baseUrl + 'applications/' + appName + '/dataexport/plantypes' + plan,
headers: {},
data: {
foo: 'bar', // This is the body part
}
});
Source: axios api
Answer from Ukasha on Stack OverflowHow about using direct axios API?
axios({
method: 'post',
url: baseUrl + 'applications/' + appName + '/dataexport/plantypes' + plan,
headers: {},
data: {
foo: 'bar', // This is the body part
}
});
Source: axios api
You can use postman to generate code. Look at this image. Follow step1 and step 2.

If your endpoint just accepts data that have been sent with Body (in postman), You should send FormData.
var formdata = new FormData();
//add three variable to form
formdata.append("imdbid", "1234");
formdata.append("token", "d48a3c54948b4c4edd9207151ff1c7a3");
formdata.append("rate", "4");
let res = await axios.post("/api/save_rate", formdata);
How get request with axios body raw json in vue js
How to access raw axios response when building programmatic-style node?
node.js - How to Send a Raw Data Body to an Axios GETRequest in React Native? - Stack Overflow
node.js - How to get raw response data from axios request? - Stack Overflow
It turns out, if I set the Content-Type header to text/plain, it won't convert it to JSON or form data and will send it as I want.
axios.post('/my-url', 'my message text', {
headers: { 'Content-Type': 'text/plain' }
});
As I dropped here having a similar problem, I'd like to supply an additional answer. I am loading an image file (from a <input type="file"> element) and sending it to the server using axios - but as raw body as opposed to wrapping it in a multipart/form-data request.
It seems that in the case of raw data, axios works best if the data is supplied in an ArrayBuffer. This can be achieved e.g. using the following code fragment (ES6):
const myFile = getMyFileFromSomewhere()
const reader = new FileReader()
reader.onload = () => {
const result = reader.result
const headers = {
'Content-Type': file.type,
'Content-Disposition': 'attachment; filename="' + file.name + '"'
}
axios.post('/upload', result, { headers: headers })
}
reader.readAsArrayBuffer(myFile)
(using the Content-Type header in this way is slightly non-standard but in my case only used as means of transporting the original file name)
See:
https://github.com/axios/axios#request-config - description of data
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/readAsArrayBuffer