Hello @kartik,
If you have an in-flight response and are using ReadableStream, you can close the stream to cancel the request.
Try This:
fetch('http://example.com').then((res) => {
const reader = res.body.getReader();
/*
* Your code for reading streams goes here
*/
// To abort/cancel HTTP request...
reader.cancel();
});
Hope this works!!
Thank You!!