• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Aldaviva / Unfucked / 39086174486

15 Oct 2026 06:11PM UTC coverage: 42.05% (-0.5%) from 42.526%
39086174486

push

github

Aldaviva
Added HTML parser integration in Unfucked.HTTP with AngleSharp, if it's installed (provided dependency). This changed the signature of the MessagBodyReader interface's Read method, affecting all external implementations. Add a convenience constructor to the console progress bar options struct. Renamed datablow block that aggregates all inputs into one output list from JoinAllBlock to CollectBlock, because join is often used in .NET to refer to a database join (what underscore refers to as zip).

710 of 2175 branches covered (32.64%)

22 of 75 new or added lines in 10 files covered. (29.33%)

130 existing lines in 6 files now uncovered.

1243 of 2956 relevant lines covered (42.05%)

160.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.56
/HTTP/Serialization/StreamBodyReader.cs
1
using System.Text;
2
using Unfucked.HTTP.Config;
3

4
namespace Unfucked.HTTP.Serialization;
5

6
public sealed class StreamBodyReader: MessageBodyReader {
7

8
    public bool CanRead<T>(string? mimeType, string? bodyPrefix) => typeof(T) == typeof(Stream);
1 ✔
9

10
    public async Task<T> Read<T>(HttpResponseMessage response, Encoding? responseEncoding, Configurable? clientConfig, CancellationToken cancellationToken) {
11
        Task<Stream> stream =
×
12
#if NET6_0_OR_GREATER
×
NEW
13
            response.Content.ReadAsStreamAsync(cancellationToken);
×
14
#else
15
            response.Content.ReadAsStreamAsync();
16
#endif
17

NEW
18
        return (T) (object) new ResponseDisposingStream(await stream.ConfigureAwait(false), response);
×
19
    }
×
20

21
    internal sealed class ResponseDisposingStream(Stream actualStream, IDisposable alsoDispose): Stream {
×
22

23
        public override bool CanRead => actualStream.CanRead;
×
24
        public override bool CanSeek => actualStream.CanSeek;
×
25
        public override bool CanWrite => actualStream.CanWrite;
×
26
        public override long Length => actualStream.Length;
×
27
        public override bool CanTimeout => actualStream.CanTimeout;
×
28
        public override long Position {
29
            get => actualStream.Position;
×
30
            set => actualStream.Position = value;
×
31
        }
32
        public override int ReadTimeout {
33
            get => actualStream.ReadTimeout;
×
34
            set => actualStream.ReadTimeout = value;
×
35
        }
36
        public override int WriteTimeout {
37
            get => actualStream.WriteTimeout;
×
38
            set => actualStream.WriteTimeout = value;
×
39
        }
40

41
        public override void Flush() => actualStream.Flush();
×
42

43
        public override int Read(byte[] buffer, int offset, int count) => actualStream.Read(buffer, offset, count);
×
44

45
        public override long Seek(long offset, SeekOrigin origin) => actualStream.Seek(offset, origin);
×
46

47
        public override void SetLength(long value) => actualStream.SetLength(value);
×
48

49
        public override void Write(byte[] buffer, int offset, int count) => actualStream.Write(buffer, offset, count);
×
50

51
        public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) => actualStream.BeginRead(buffer, offset, count, callback, state);
×
52

53
        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? callback, object? state) => actualStream.BeginWrite(buffer, offset, count, callback, state);
×
54

55
        public override void Close() => actualStream.Close();
×
56

57
        public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) => actualStream.CopyToAsync(destination, bufferSize, cancellationToken);
×
58

59
        public override int EndRead(IAsyncResult asyncResult) => actualStream.EndRead(asyncResult);
×
60

61
        public override void EndWrite(IAsyncResult asyncResult) => actualStream.EndWrite(asyncResult);
×
62

63
        public override Task FlushAsync(CancellationToken cancellationToken) => actualStream.FlushAsync(cancellationToken);
×
64

65
        public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => actualStream.ReadAsync(buffer, offset, count, cancellationToken);
×
66

67
        public override int ReadByte() => actualStream.ReadByte();
×
68

69
        public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => actualStream.WriteAsync(buffer, offset, count, cancellationToken);
×
70

71
        public override void WriteByte(byte value) => actualStream.WriteByte(value);
×
72

73
        protected override void Dispose(bool disposing) {
74
            if (disposing) {
×
75
                actualStream.Dispose();
×
76
                alsoDispose.Dispose();
×
77
            }
78
            base.Dispose(disposing);
×
79
        }
×
80

81
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_0_OR_GREATER
82
        public override void CopyTo(Stream destination, int bufferSize) => actualStream.CopyTo(destination, bufferSize);
83
#endif
84

85
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
86
        public override int Read(Span<byte> buffer) => actualStream.Read(buffer);
87

88
        public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken = default) => actualStream.ReadAsync(buffer, cancellationToken);
89

90
        public override void Write(ReadOnlySpan<byte> buffer) => actualStream.Write(buffer);
91

92
        public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default) => actualStream.WriteAsync(buffer, cancellationToken);
93
#endif
94

95
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_0_OR_GREATER
96
        public override async ValueTask DisposeAsync() {
97
            await actualStream.DisposeAsync().ConfigureAwait(false);
98
            if (alsoDispose is IAsyncDisposable alsoDisposeAsyncDisposable) {
×
99
                await alsoDisposeAsyncDisposable.DisposeAsync().ConfigureAwait(false);
100
            } else {
101
                alsoDispose.Dispose();
102
            }
103
            await base.DisposeAsync().ConfigureAwait(false);
104
        }
105
#endif
106

107
    }
108

109
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc