< Summary

Line coverage
0%
Covered lines: 0
Uncovered lines: 14
Coverable lines: 14
Total lines: 44
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 2
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
ToString()0%220%

File(s)

https://raw.githubusercontent.com/dotnet/runtime/811a7eabb75c42db53440e8ba3f60c07511cfd1f/src/libraries/Common/src/System/Net/Http/aspnetcore/Http3/QPack/HeaderField.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System.Diagnostics;
 5using System.Text;
 6
 7namespace System.Net.Http.QPack
 8{
 9    internal readonly struct HeaderField
 10    {
 11        // https://quicwg.org/base-drafts/draft-ietf-quic-http.html#section-4.1.1.3-1
 12        // public for internal use in aspnetcore
 13        public const int RfcOverhead = 32;
 14
 15        public HeaderField(byte[] name, byte[] value)
 016        {
 017            Debug.Assert(name.Length > 0);
 18
 019            Name = name;
 020            Value = value;
 021        }
 22
 023        public byte[] Name { get; }
 24
 025        public byte[] Value { get; }
 26
 27        public int Length => GetLength(Name.Length, Value.Length);
 28
 29        public static int GetLength(int nameLength, int valueLength) => nameLength + valueLength + RfcOverhead;
 30
 31        public override string ToString()
 032        {
 033            if (Name != null)
 034            {
 035                return Encoding.ASCII.GetString(Name) + ": " + Encoding.ASCII.GetString(Value);
 36            }
 37            else
 038            {
 039                return "<empty>";
 40            }
 041        }
 42    }
 43}
 44