Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions PolyShim/Net50/HttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ internal static class MemberPolyfills_Net50_HttpClient
#if FEATURE_TASK
extension(HttpClient httpClient)
{
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstreamasync#system-net-http-httpclient-getstreamasync(system-string-system-threading-cancellationtoken)
public async Task<Stream> GetStreamAsync(string requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstreamasync#system-net-http-httpclient-getstreamasync(system-uri-system-threading-cancellationtoken)
public async Task<Stream> GetStreamAsync(Uri requestUri,
CancellationToken cancellationToken = default)
{
try
Expand All @@ -46,13 +46,13 @@ public async Task<Stream> GetStreamAsync(string requestUri,
}
}

// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstreamasync#system-net-http-httpclient-getstreamasync(system-uri-system-threading-cancellationtoken)
public async Task<Stream> GetStreamAsync(Uri requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstreamasync#system-net-http-httpclient-getstreamasync(system-string-system-threading-cancellationtoken)
public async Task<Stream> GetStreamAsync(string requestUri,
CancellationToken cancellationToken = default) =>
await httpClient.GetStreamAsync(requestUri.ToString(), cancellationToken).ConfigureAwait(false);
await httpClient.GetStreamAsync(new Uri(requestUri, UriKind.RelativeOrAbsolute), cancellationToken).ConfigureAwait(false);

// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getbytearrayasync#system-net-http-httpclient-getbytearrayasync(system-string-system-threading-cancellationtoken)
public async Task<byte[]> GetByteArrayAsync(string requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getbytearrayasync#system-net-http-httpclient-getbytearrayasync(system-uri-system-threading-cancellationtoken)
public async Task<byte[]> GetByteArrayAsync(Uri requestUri,
CancellationToken cancellationToken = default)
{
try
Expand All @@ -76,13 +76,13 @@ public async Task<byte[]> GetByteArrayAsync(string requestUri,
}
}

// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getbytearrayasync#system-net-http-httpclient-getbytearrayasync(system-uri-system-threading-cancellationtoken)
public async Task<byte[]> GetByteArrayAsync(Uri requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getbytearrayasync#system-net-http-httpclient-getbytearrayasync(system-string-system-threading-cancellationtoken)
public async Task<byte[]> GetByteArrayAsync(string requestUri,
CancellationToken cancellationToken = default) =>
await httpClient.GetByteArrayAsync(requestUri.ToString(), cancellationToken).ConfigureAwait(false);
await httpClient.GetByteArrayAsync(new Uri(requestUri, UriKind.RelativeOrAbsolute), cancellationToken).ConfigureAwait(false);

// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstringasync#system-net-http-httpclient-getstringasync(system-string-system-threading-cancellationtoken)
public async Task<string> GetStringAsync(string requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstringasync#system-net-http-httpclient-getstringasync(system-uri-system-threading-cancellationtoken)
public async Task<string> GetStringAsync(Uri requestUri,
CancellationToken cancellationToken = default)
{
try
Expand All @@ -106,10 +106,10 @@ public async Task<string> GetStringAsync(string requestUri,
}
}

// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstringasync#system-net-http-httpclient-getstringasync(system-uri-system-threading-cancellationtoken)
public async Task<string> GetStringAsync(Uri requestUri,
// https://learn.microsoft.com/dotnet/api/system.net.http.httpclient.getstringasync#system-net-http-httpclient-getstringasync(system-string-system-threading-cancellationtoken)
public async Task<string> GetStringAsync(string requestUri,
CancellationToken cancellationToken = default) =>
await httpClient.GetStringAsync(requestUri.ToString(), cancellationToken).ConfigureAwait(false);
await httpClient.GetStringAsync(new Uri(requestUri, UriKind.RelativeOrAbsolute), cancellationToken).ConfigureAwait(false);
}
#endif
}
Expand Down
Loading