pagekit / vue-resource

The HTTP client for Vue.js
MIT License
10.08k stars 1.6k forks source link

timeout working ? #702

Open guizmo51 opened 6 years ago

guizmo51 commented 6 years ago

Hello ! I have an issue with the timeout in request. I do this.$resource('api/validation', {}, {}, {timeout: 250}) The "timeout" is well caught by the the Promise as error, it's OK. But on server side the request is received. I think the vue-resource triggers timeout but it's not abort..

Thanks for your help

teuzinPereira commented 6 years ago

Hello @guizmo51 , yes it is. I used this cod

this.$http .post("urlToServer", objJson, { timeout: 100, emulateJSON: true, emulateHTTP: true }) .then(res => res.json()) .then( data => { // EveryThing's ok console.log(JSON.stringify(data)); }, err => { //Treat timeout error console.log(JSON.stringify(data)); } );

Don't forget to change the variables!