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);
});
-
What problem are you trying to solve?jub0bs– jub0bs2024年08月23日 13:04:45 +00:00Commented Aug 23, 2024 at 13:04
1 Answer 1
Preflight requests are only made by browsers, not by axios running on a server.
answered Aug 23, 2024 at 10:48
Heiko Theißen
18.3k2 gold badges14 silver badges50 bronze badges
Sign up to request clarification or add additional context in comments.