< Summary

Information
Class: System.Net.Http.Headers.CookieHeaderParser
Assembly: System.Net.Http
File(s): D:\runner\runtime\src\libraries\System.Net.Http\src\System\Net\Http\Headers\CookieHeaderParser.cs
Line coverage
100%
Covered lines: 14
Uncovered lines: 0
Coverable lines: 14
Total lines: 37
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor()100%11100%
TryParseValue(...)100%44100%

File(s)

D:\runner\runtime\src\libraries\System.Net.Http\src\System\Net\Http\Headers\CookieHeaderParser.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.Diagnostics.CodeAnalysis;
 6
 7namespace System.Net.Http.Headers
 8{
 9    internal sealed class CookieHeaderParser : HttpHeaderParser
 10    {
 111        internal static readonly CookieHeaderParser Parser = new CookieHeaderParser();
 12
 13        // According to RFC 6265 Section 4.2 multiple cookies have
 14        // to be concatenated using "; " as the separator.
 15        private CookieHeaderParser()
 116            : base(true, "; ")
 117        {
 118        }
 19
 20        public override bool TryParseValue(string? value, object? storeValue, ref int index, [NotNullWhen(true)] out obj
 4821        {
 4822            Debug.Assert(index == 0);
 23
 24            // Some headers support empty/null values. This one doesn't.
 4825            if (string.IsNullOrEmpty(value) || HttpRuleParser.ContainsNewLineOrNull(value))
 1226            {
 1227                parsedValue = null;
 1228                return false;
 29            }
 30
 3631            parsedValue = value;
 3632            index = value.Length;
 33
 3634            return true;
 4835        }
 36    }
 37}