With timeout: Uncaught TypeError: request.cancel is not a function
See original GitHub issueWhen a timeout is set, and when the requested url does not exists or the target server is offline, the request is cancelled with an error:
import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource)
Vue.http.get('http://does-not-exist-or-is-offline.com/something', { timeout: 3000 })
.then(response => {
console.log(response)
}, response => {
console.log('error')
})
It returns Uncaught TypeError: request.cancel is not a function
and then error
Is it a bug or is there a way to handle this situation?
(UPDATE: i am using ^0.9.1)
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Canceling request: "r.cancel is not a function" · Issue #1066
I'm trying to cancel an ongoing request like this: const request = got(url, ... but I get TypeError: r.cancel is not a function...
Read more >Promise - is it possible to force cancel a promise
In modern JavaScript - no. Promises have settled (hah) and it appears like it will never be possible to cancel a (pending) promise....
Read more >clearTimeout() - Web APIs - MDN Web Docs
The global clearTimeout() method cancels a timeout previously established by calling setTimeout().
Read more >How to cancel an HTTP request in Node.js - Simon Plenderleith
This allows us to cancel the scheduled timeout by calling the cancelTimeout. abort() method. We do this in the makeRequest() function above ...
Read more >Timers | Node.js v19.3.0 Documentation
If callback is not a function, a TypeError will be thrown. This method has a custom variant for promises that is available using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@michaelhue yes https://github.com/vuejs/vue-resource/blob/master/src/http/interceptor/timeout.js#L11
maybe it should be
request.abort();
closed in #311