lundi 5 juin 2017

Not using CORS but axios post method does not post to backend laravel controller method in chrome

I am using VueJS 2.0 and axios with laravel 5.

What might be the reason that my axios post are not working in chrome?
I am not using CORS.
However the GET calls works in chrome but the post is not working and I am not getting any error either.
But the post is failing in chrome and works well in firefox.

window.axios = require('axios');
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = window.Laravel.csrfToken;
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

Vue.prototype.$http = axios;

let data = { a : 'something' };

 this.$http.post('/config/file/', data)
        .then(response => console.log(" Call is successful ...!" ))
         .catch(error => console.log(" Received error ... Operation failed"));

In chrome, this call just return the success message without hitting the backend laravel controller method that handles the post action from this route. The same code works in firefox. Any idea what am I missing here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire