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

Aldaviva / Unfucked / 41996332001

05 Nov 2026 08:33AM UTC coverage: 46.118% (+0.2%) from 45.954%
41996332001

push

github

Aldaviva
HTTP: automatically try to register Noda Time converters to default JsonSerializerOptions if the assembly; allow trailing commas in deserialized JSON; allow deserializing JSON response bodies to IAsyncEnumerable<T>, including auto-detecting when it's a whitespace-separated sequence of nodes instead of one array with System.Text.Json ≥ 9. Extracted partial stream buffering logic to internal method so MessageBodyReaders that need it can call it too. Unfucked: removed IAsyncEnumerator.ToList because this functionality is provided in the System.Linq.AsyncEnumerable package's AsyncEnumerable.ToListAsync extension method; allow users to disable showing progress bar in Windows taskbar button and Windows Terminal tab, in case there are multiple progress bars on screen at one time to prevent them from fighting.

839 of 2445 branches covered (34.31%)

40 of 57 new or added lines in 5 files covered. (70.18%)

1 existing line in 1 file now uncovered.

1485 of 3220 relevant lines covered (46.12%)

151.15 hits per line

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

2.86
/HTTP/Serialization/StreamBodyReader.cs
1
using System.Net.Http.Headers;
2
using System.Text;
3
using Unfucked.HTTP.Config;
4

5
namespace Unfucked.HTTP.Serialization;
6

7
public sealed class StreamBodyReader: AbstractMessageBodyReader {
8

9
    /// <inheritdoc />
10
    public override bool CanRead<T>(MediaTypeHeaderValue? contentType) => typeof(T) == typeof(Stream);
4 ✔
11

12
    /// <inheritdoc />
13
    public override async Task<T> Read<T>(HttpResponseMessage response, Encoding? responseEncoding, Configurable? clientConfig, CancellationToken cancellationToken) =>
14
        (T) (object) new ResponseDisposingStream(await GetBodyStream(response, cancellationToken), response);
×
15

16
    private sealed class ResponseDisposingStream(Stream actualStream, IDisposable alsoDispose): Stream {
×
17

18
        protected override void Dispose(bool disposing) {
NEW
19
            if (disposing) {
×
NEW
20
                actualStream.Dispose();
×
NEW
21
                alsoDispose.Dispose();
×
22
            }
NEW
23
            base.Dispose(disposing);
×
NEW
24
        }
×
25

26
        #region delegated
27

28
        public override bool CanRead => actualStream.CanRead;
×
29
        public override bool CanSeek => actualStream.CanSeek;
×
30
        public override bool CanWrite => actualStream.CanWrite;
×
31
        public override long Length => actualStream.Length;
×
32
        public override bool CanTimeout => actualStream.CanTimeout;
×
33
        public override long Position {
34
            get => actualStream.Position;
×
35
            set => actualStream.Position = value;
×
36
        }
37
        public override int ReadTimeout {
38
            get => actualStream.ReadTimeout;
×
39
            set => actualStream.ReadTimeout = value;
×
40
        }
41
        public override int WriteTimeout {
42
            get => actualStream.WriteTimeout;
×
43
            set => actualStream.WriteTimeout = value;
×
44
        }
45

46
        public override void Flush() => actualStream.Flush();
×
47

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

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

52
        public override void SetLength(long value) => actualStream.SetLength(value);
×
53

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

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

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

60
        public override void Close() => actualStream.Close();
×
61

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

64
        public override int EndRead(IAsyncResult asyncResult) => actualStream.EndRead(asyncResult);
×
65

66
        public override void EndWrite(IAsyncResult asyncResult) => actualStream.EndWrite(asyncResult);
×
67

68
        public override Task FlushAsync(CancellationToken cancellationToken) => actualStream.FlushAsync(cancellationToken);
×
69

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

72
        public override int ReadByte() => actualStream.ReadByte();
×
73

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

76
        public override void WriteByte(byte value) => actualStream.WriteByte(value);
×
77

78
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_0_OR_GREATER
79
        public override void CopyTo(Stream destination, int bufferSize) => actualStream.CopyTo(destination, bufferSize);
80
#endif
81

82
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP2_1_OR_GREATER
83
        public override int Read(Span<byte> buffer) => actualStream.Read(buffer);
84

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

87
        public override void Write(ReadOnlySpan<byte> buffer) => actualStream.Write(buffer);
88

89
        public override ValueTask WriteAsync(ReadOnlyMemory<byte> buffer, CancellationToken cancellationToken = default) => actualStream.WriteAsync(buffer, cancellationToken);
90
#endif
91

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

104
        #endregion
105

106
    }
107

108
}
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