I'm using axios for my http requests, and AbortController
to abort them.
And I figured that running conroller.abort()
will throw an error immediatly and doesn't wait for the server response, and the server sometime will keep processing until it hits the request cancelled at last, i.e. after running the process completely.
So I want to wait for the server after the abort
is called, if the server returned my custom status code 499
then it's canceled safely, otherwise, run the normal process for success or error codes.
Does cancelToken.source()
work in this case, and is it recommended?
After research, I found it's not possible to do so.
The point of controller.abort()
is to terminate the connection immediately.
So it sends an abort signal to the server and terminate immediately without waiting for any response.