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()); }
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);
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;