Is there a way to abort an ongoing client request when using Autorest with typescript?
I noticed the ServiceClient object has the ability to specify RequestPrepareOptions, but I'm unclear how to pass the request options to the outgoing request method. Or perhaps there's another means to do the cancelation?
It seems you can use the browser abortController mechanism. You have to create an abort signal:
Then pass it in
OperationArguments.options.abortSignalwhen callingThen call
aborton then abortController :...and the promise returned by
sendOperationRequestshall be rejected with anabortError.See provided javascript example : https://mdn.github.io/dom-examples/abort-api/
Note: The feature is marked experimental, so it may not be supported by all browsers.