示例#1
0
        public static async Task <byte[]> GetBytesAsync(
            this HttpService http, Uri uri, CancellationToken cancellationToken,
            CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null)
        {
            using var response = await http.GetAsync(uri, cancellationToken,
                                                     cache : cache, cacheKey : cacheKey, repeat : repeat, timeoutSeconds : timeoutSeconds);

            return(await response.ReadBytesAsync());
        }
示例#2
0
 public static Task <IHttpResponse> GetAsync(
     this HttpService http, string url, CancellationToken cancellationToken,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 http.GetAsync(new Uri(url), cancellationToken,
               cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds);
示例#3
0
 public static IHttpResponse Get(
     this HttpService http, Uri uri,
     CacheMode?cache = null, string?cacheKey = null, bool?repeat = null, int?timeoutSeconds = null) =>
 Task.Run(() => http.GetAsync(uri, Kit.CancellationToken,
                              cache: cache, cacheKey: cacheKey, repeat: repeat, timeoutSeconds: timeoutSeconds)).Result;