pagekit / vue-resource

The HTTP client for Vue.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

timeout working ?

guizmo51 opened this issue · comments

commented

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

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!