This commit is contained in:
Stef Heyenrath
2026-02-14 17:28:37 +01:00
parent 385450a3a8
commit 334675f39c
9 changed files with 139 additions and 132 deletions

View File

@@ -0,0 +1,21 @@
// Copyright © WireMock.Net
#if !NET5_0_OR_GREATER
namespace System.Net.Http;
/// <summary>
/// Extension methods for HttpContent to provide CancellationToken support in frameworks before .NET 5.0.
/// </summary>
internal static class HttpContentExtensions
{
public static Task<string> ReadAsStringAsync(this HttpContent content, CancellationToken _)
{
return content.ReadAsStringAsync();
}
public static Task<byte[]> ReadAsByteArrayAsync(this HttpContent content, CancellationToken _)
{
return content.ReadAsByteArrayAsync();
}
}
#endif