Is it possible to abort a request while its pending?
Code:
var response = await request({uri :”https://www.google.com”})
How would I go about aborting this request?(Not talking about setting timeout)
Is it possible to abort a request while its pending?
Code:
var response = await request({uri :”https://www.google.com”})
How would I go about aborting this request?(Not talking about setting timeout)
You have to call: .cancel
const req = request({uri :”https://www.google.com”})
req.cancel();
Have in mind that it will be tricky to use with await
, unless it's happening in another part of the code. If you show as a fully working example, and when you want to abort the request it will be easy to give you an example.
Here is the documentation:
This method cancels the request using Bluebird's cancellation feature.
When .cancel()
is called: