RequestAsync() публичный Метод

Performs an asynchronous request that can be cancelled.
public RequestAsync ( IRequest request, CancellationToken cancel ) : Task
request IRequest The options to consider.
cancel System.Threading.CancellationToken The token for cancelling the task.
Результат Task
Пример #1
0
        public async Task DownloadFtpRfcViaFtpRequester()
        {
            var url = "ftp://ftp.funet.fi/pub/standards/RFC/rfc959.txt";
            var requester = new FtpRequester();
            var request = new Request { Address = Url.Create(url) };

            var response = await requester.RequestAsync(request, CancellationToken.None);
            Assert.IsNotNull(response);

            var content = await new StreamReader(response.Content).ReadToEndAsync();
            Assert.AreEqual(147316, content.Length);
        }