I could not find any way to cancel a request using Siesta Framework. Is this possible, and how?
I found that there is a method cancel()
, which should be called on the Request
object. As documented, it is not guaranteed to really cancel the request if it is already started, but it will at least ignore the result and send you a completion/failure, which you can then handle accordingly.
Example:
let siestaRequest = MyAPI.profile.request(.post, json: ["foo": [1,2,3]])
// when needed, later
siestaRequest.cancel()