2023-11-21 03:59:29 +03:00
|
|
|
|
using System.Net.Http;
|
2020-11-26 00:52:29 +03:00
|
|
|
|
|
|
|
|
|
namespace Refit
|
|
|
|
|
{
|
2023-04-12 10:30:13 +03:00
|
|
|
|
#if !NET6_0_OR_GREATER
|
2020-11-26 00:52:29 +03:00
|
|
|
|
static class HttpContentExtensions
|
|
|
|
|
{
|
2020-11-26 02:38:25 +03:00
|
|
|
|
#pragma warning disable IDE0079 // Remove unnecessary suppression
|
2020-11-26 02:05:34 +03:00
|
|
|
|
#pragma warning disable IDE0060 // Remove unused parameter
|
2023-11-27 01:50:46 +03:00
|
|
|
|
public static Task<Stream> ReadAsStreamAsync(
|
|
|
|
|
this HttpContent httpContent,
|
|
|
|
|
CancellationToken cancellationToken
|
|
|
|
|
)
|
2020-11-26 00:52:29 +03:00
|
|
|
|
{
|
|
|
|
|
return httpContent.ReadAsStreamAsync();
|
|
|
|
|
}
|
|
|
|
|
|
2023-11-27 01:50:46 +03:00
|
|
|
|
public static Task<string> ReadAsStringAsync(
|
|
|
|
|
this HttpContent httpContent,
|
|
|
|
|
CancellationToken cancellationToken
|
|
|
|
|
)
|
2020-11-26 00:52:29 +03:00
|
|
|
|
{
|
|
|
|
|
return httpContent.ReadAsStringAsync();
|
|
|
|
|
}
|
2020-11-26 02:05:34 +03:00
|
|
|
|
#pragma warning restore IDE0060 // Remove unused parameter
|
2020-11-26 02:38:25 +03:00
|
|
|
|
#pragma warning restore IDE0079 // Remove unnecessary suppression
|
2020-11-26 00:52:29 +03:00
|
|
|
|
}
|
2020-11-26 02:05:34 +03:00
|
|
|
|
#endif
|
2020-11-26 00:52:29 +03:00
|
|
|
|
}
|