[fix]Config创建默认配置文件的开关Runtime.CreateConfigOnMissing,仅需对自动创建生效,而不应该阻止用户主动Save
智能大石头 编写于 2024-08-09 00:30:41 石头 提交于 2024-08-10 14:22:24
X
using NewLife.Http.Headers;

namespace NewLife.Http;

public abstract class HttpContent
{
    public HttpContentHeaders Headers { get; set; } = new();

    public virtual Task<String> ReadAsStringAsync() => ReadAsStringAsync(default);

    public virtual async Task<String> ReadAsStringAsync(CancellationToken cancellationToken) => (await ReadAsByteArrayAsync(cancellationToken)).ToStr();

    public virtual async Task<Stream> ReadAsStreamAsync(CancellationToken cancellationToken) => new MemoryStream(await ReadAsByteArrayAsync(cancellationToken));

    public virtual Task<Byte[]> ReadAsByteArrayAsync() => ReadAsByteArrayAsync(default);

    public abstract Task<Byte[]> ReadAsByteArrayAsync(CancellationToken cancellationToken);
}