< Summary

Information
Class: Elsa.Http.HttpHeaders
Assembly: Elsa.Http
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Models/HttpHeaders.cs
Line coverage
66%
Covered lines: 10
Uncovered lines: 5
Coverable lines: 15
Total lines: 44
Line coverage: 66.6%
Branch coverage
50%
Covered branches: 4
Total branches: 8
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.ctor()100%11100%
.ctor(...)0%620%
.ctor(...)100%22100%
.ctor(...)100%22100%
get_ContentType()0%620%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.Http/Models/HttpHeaders.cs

#LineLine coverage
 1using System.Net.Http.Headers;
 2using System.Text.Json.Serialization;
 3using Elsa.Extensions;
 4using Elsa.Http.Serialization;
 5
 6namespace Elsa.Http;
 7
 8/// <summary>
 9/// Represents the headers of an HTTP message.
 10/// </summary>
 11[JsonConverter(typeof(HttpHeadersConverter))]
 12public class HttpHeaders : Dictionary<string, string[]>
 13{
 14    /// <inheritdoc />
 16115    public HttpHeaders()
 16    {
 16117    }
 18
 19    /// <inheritdoc />
 020    public HttpHeaders(IDictionary<string, string[]> source)
 21    {
 022        foreach (var item in source)
 023            Add(item.Key, item.Value);
 024    }
 25
 26    /// <inheritdoc />
 4127    public HttpHeaders(HttpResponseHeaders source)
 28    {
 9429        foreach (var item in source)
 630            Add(item.Key, item.Value.ToArray());
 4131    }
 32
 33    /// <inheritdoc />
 1934    public HttpHeaders(HttpContentHeaders source)
 35    {
 11636        foreach (var item in source)
 3937            Add(item.Key, item.Value.ToArray());
 1938    }
 39
 40    /// <summary>
 41    /// Gets the content type.
 42    /// </summary>
 043    public string? ContentType => this.GetValue("content-type")?[0];
 44}