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

Aldaviva / Unfucked / 19128584806

06 Nov 2025 07:47AM UTC coverage: 0.396% (-39.5%) from 39.923%
19128584806

push

github

Aldaviva
DateTime: added IsBefore and IsAfter for ZonedDateTime, not just OffsetDateTime. DI: Allow super registration for keyed services; fixed super registration of a hosted service causing an infinite recursion during injection. STUN: updated fallback server list, most of which have gone offline (including Google, confusingly); made HttpClient optional.

2 of 1605 branches covered (0.12%)

0 of 55 new or added lines in 2 files covered. (0.0%)

945 existing lines in 35 files now uncovered.

9 of 2272 relevant lines covered (0.4%)

0.04 hits per line

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

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

4
namespace Unfucked.HTTP.Serialization;
5

6
public class StreamBodyReader: MessageBodyReader {
7

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

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

18
        return (T) (object) new ResponseDisposingStream(await stream.ConfigureAwait(false), responseBody);
×
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 · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc