public Utf8StringContent(System.Utf8String content, string? mediaType) { }
protected override System.Threading.Tasks.Task<System.IO.Stream> CreateContentReadStreamAsync() { throw null; }
protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context) { throw null; }
+ protected override System.Threading.Tasks.Task SerializeToStreamAsync(System.IO.Stream stream, System.Net.TransportContext? context, System.Threading.CancellationToken cancellationToken) { throw null; }
protected override bool TryComputeLength(out long length) { throw null; }
}
}
using System.IO;
using System.Net.Http.Headers;
+using System.Threading;
using System.Threading.Tasks;
namespace System.Net.Http
};
}
- protected override Task<Stream> CreateContentReadStreamAsync()
- {
- return Task.FromResult<Stream>(new Utf8StringStream(_content));
- }
+ protected override Task<Stream> CreateContentReadStreamAsync() =>
+ Task.FromResult<Stream>(new Utf8StringStream(_content));
- protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context)
- {
- return stream.WriteAsync(_content.AsMemoryBytes()).AsTask();
- }
+ protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) =>
+ SerializeToStreamAsync(stream, context, default);
+
+ protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context, CancellationToken cancellationToken) =>
+ stream.WriteAsync(_content.AsMemoryBytes(), cancellationToken).AsTask();
protected override bool TryComputeLength(out long length)
{