Please I'm making a POST request from my web Server(Node.js) to another web Server(Php). Can it be possible for my Node.js Server to make a preflight/OPTION request to the other PHP web server if the content-type: is application/Jason in Axios?
var axios = require('axios');
var data = {"disco_name":disco,
"amount": 1000,
"meter_number": 2737373,
"MeterType": PREPAID
}
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://datastationapi.com/api/billpayment/',
headers: {
'Authorization': 'Token 3cd8882f7e5e92',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Preflight requests are only made by browsers, not by axios running on a server.