Friday 30 June 2017

Mongo not grabbing data when POST sent from Axios, but works when sent from Postman

Not sure what is going on here. I sort of hacked around the parameter syntax for axios and did this:axios.post('api/gen-traffic?' + 'param1=' + this.state.param1 + '&param2=' + this.state.param2 ) .then((response) => { console.log('In then') console.log(response) }) .catch((error) => { console.log('In catch') console.log(error) }); And when I send this URL through Postman, everything works fine, but when I send it through Axios and query my Mongo instance using the params, one of them ends up undefined for no reason. However, when I initially post from Postman then do another one right after from Axios, it works. Any guidance? Can post some more code later.

Submitted June 30, 2017 at 07:46PM by tangerto

No comments:

Post a Comment