When I try to post to the other server using axios it first sends OPTIONS request then POST. When I check network connection it sends object with fields I wanted just the this.state.array is empty.
It's weird beacuse when I debug it just before sending it is not empty?
var someProperty="value";
const objectToSend = {
content: this.state.myArray,
prop1: someProperty,
abc:'3456'
};
console.log('user obj------->',objectToSend); // everything is fine { content: Array(0), prop1: 'value', abc:'3456'}
axios.post('http://server:8544/api/post', objectToSend)
.then(function (response) {
}) // it sends { content: [], prop1: someProperty, abc:'3456'}
//method which updates state of array(or key value pair to be precise)
processAnswer(q, a) {
var key = q;
var val = a;
this.state.myArray['\"'+key+'\"'] = val;
}
POSTrequest going or is it stopping afterOPTIONSrequest?array?