public async Task <Response> GetString(TestContext ctx, CancellationToken cancellationToken) { var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); cts.Token.Register(() => Client.CancelPendingRequests()); try { var body = await Client.GetStringAsync(RequestUri); return(new SimpleResponse(this, HttpStatusCode.OK, StringContent.CreateMaybeNull(body))); } catch (Exception ex) { return(new SimpleResponse(this, HttpStatusCode.InternalServerError, null, ex)); } finally { cts.Dispose(); } }