diff --git a/PowerKit/Extensions/HttpClientExtensions.cs b/PowerKit/Extensions/HttpClientExtensions.cs index 31db7b0..7031133 100644 --- a/PowerKit/Extensions/HttpClientExtensions.cs +++ b/PowerKit/Extensions/HttpClientExtensions.cs @@ -20,7 +20,7 @@ internal static class HttpClientExtensions /// Downloads the content at the specified URI to a local file. /// public async Task DownloadAsync( - string requestUri, + Uri requestUri, string filePath, IProgress? progress = null, CancellationToken cancellationToken = default @@ -43,10 +43,27 @@ await response } /// - /// Sends a HEAD request to the specified URI and returns the response. + /// Downloads the content at the specified URI to a local file. /// - public async ValueTask HeadAsync( + public async Task DownloadAsync( string requestUri, + string filePath, + IProgress? progress = null, + CancellationToken cancellationToken = default + ) => + await http.DownloadAsync( + new Uri(requestUri, UriKind.RelativeOrAbsolute), + filePath, + progress, + cancellationToken + ) + .ConfigureAwait(false); + + /// + /// Sends a HEAD request to the specified URI and returns the response. + /// + public async Task HeadAsync( + Uri requestUri, CancellationToken cancellationToken = default ) { @@ -58,6 +75,16 @@ public async ValueTask HeadAsync( ) .ConfigureAwait(false); } + + /// + /// Sends a HEAD request to the specified URI and returns the response. + /// + public async Task HeadAsync( + string requestUri, + CancellationToken cancellationToken = default + ) => + await http.HeadAsync(new Uri(requestUri, UriKind.RelativeOrAbsolute), cancellationToken) + .ConfigureAwait(false); } } #endif