< Summary - Kestrun — Combined Coverage

Information
Class: Kestrun.Hosting.Options.KestrunOptions
Assembly: Kestrun
File(s): /home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/KestrunOptions.cs
Tag: Kestrun/Kestrun@eeafbe813231ed23417e7b339e170e307b2c86f9
Line coverage
92%
Covered lines: 25
Uncovered lines: 2
Coverable lines: 27
Total lines: 119
Line coverage: 92.5%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Coverage history

Coverage history 0 25 50 75 100 09/12/2025 - 13:32:05 Line coverage: 94.7% (18/19) Total lines: 81 Tag: Kestrun/Kestrun@63ea5841fe73fd164406accba17a956e8c08357f10/13/2025 - 16:52:37 Line coverage: 100% (21/21) Total lines: 88 Tag: Kestrun/Kestrun@10d476bee71c71ad215bb8ab59f219887b5b4a5e01/17/2026 - 04:33:35 Line coverage: 100% (22/22) Total lines: 98 Tag: Kestrun/Kestrun@aca34ea8d284564e2f9f6616dc937668dce926ba02/05/2026 - 00:28:18 Line coverage: 100% (24/24) Total lines: 108 Tag: Kestrun/Kestrun@d9261bd752e45afa789d10bc0c82b7d5724d958902/18/2026 - 08:33:07 Line coverage: 92.5% (25/27) Total lines: 119 Tag: Kestrun/Kestrun@bf8a937cfb7e8936c225b9df4608f8ddd85558b1

Coverage delta

Coverage delta 8 -8

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
.cctor()100%11100%
get_ServerOptions()100%11100%
get_ServerLimits()100%11100%
get_ApplicationName()100%11100%
get_MaxRunspaces()100%11100%
get_MinRunspaces()100%11100%
get_MaxSchedulerRunspaces()100%11100%
get_Health()100%11100%
get_Listeners()100%11100%
get_HttpsConnectionAdapter()100%11100%
get_ListenUnixSockets()100%11100%
get_NamedPipeNames()100%11100%
get_NamedPipeOptions()100%11100%
get_DefaultResponseMediaType()100%210%
.ctor()100%11100%
get_DefaultApiResponseMediaType()100%210%
get_DefaultUploadPath()100%11100%

File(s)

/home/runner/work/Kestrun/Kestrun/src/CSharp/Kestrun/Hosting/Options/KestrunOptions.cs

#LineLine coverage
 1using Microsoft.AspNetCore.Server.Kestrel.Core;
 2using Microsoft.AspNetCore.Server.Kestrel.Https;
 3using Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes;
 4using Kestrun.Health;
 5namespace Kestrun.Hosting.Options;
 6
 7/// <summary>
 8/// Simple options class for configuring Kestrel server settings.
 9/// </summary>
 10/// <remarks>
 11/// This class provides a strongly-typed alternative to using a hashtable for Kestrel server options.
 12/// </remarks>
 13public class KestrunOptions
 14{
 15    /// <summary>
 16    /// Default media type value for responses.
 17    /// </summary>
 18    private const string DefaultResponseMediaTypeValue = "text/plain";
 19    /// <summary>
 20    /// Default media type value for API responses.
 21    /// </summary>
 22    private const string DefaultApiResponseMediaTypeValue = "application/json";
 23
 24    /// <summary>
 25    /// Default upload path value for form parts.
 26    /// </summary>
 127    private static readonly string DefaultUploadPathValue = Path.Combine(Path.GetTempPath(), "kestrun-uploads");
 28
 29    /// <summary>
 30    /// Gets or sets the Kestrel server options.
 31    /// </summary>
 134632    public KestrelServerOptions ServerOptions { get; set; }
 33
 34    /// <summary>Provides access to request limit options. Use a hashtable or a KestrelServerLimits instance.</summary>
 235    public KestrelServerLimits ServerLimits => ServerOptions.Limits;
 36
 37    /// <summary>Application name (optional, for diagnostics).</summary>
 64438    public string? ApplicationName { get; set; }
 39
 40    /// <summary>
 41    /// Gets or sets the maximum number of runspaces to use for script execution.
 42    /// </summary>
 6643    public int? MaxRunspaces { get; set; }
 44
 45    /// <summary>
 46    /// Gets or sets the minimum number of runspaces to use for script execution.
 47    /// Defaults to 1.
 48    /// </summary>
 135449    public int MinRunspaces { get; set; }
 50
 51    /// <summary>
 52    /// Gets or sets the maximum number of runspaces to use for the scheduler service.
 53    /// Defaults to 8.
 54    /// </summary>
 128955    public int MaxSchedulerRunspaces { get; set; }
 56
 57    /// <summary>
 58    /// Gets or sets the health endpoint configuration.
 59    /// </summary>
 257260    public HealthEndpointOptions Health { get; set; } = new();
 61
 62    /// <summary>
 63    /// List of configured listeners for the Kestrel server.
 64    /// Each listener can be configured with its own IP address, port, protocols, and other options.
 65    /// </summary>
 29566    public List<ListenerOptions> Listeners { get; }
 67
 68    /// <summary>
 69    /// Gets the HTTPS connection adapter options.
 70    /// </summary>
 6371    public HttpsConnectionAdapterOptions? HttpsConnectionAdapter { get; set; }
 72
 73    /// <summary>
 74    /// Optional path to a Unix domain socket for Kestrel to listen on.
 75    /// </summary>
 6776    public List<string> ListenUnixSockets { get; }
 77
 78    /// <summary>
 79    /// Optional name of a Named Pipe for Kestrel to listen on.
 80    /// </summary>
 6781    public List<string> NamedPipeNames { get; }
 82
 83    /// <summary>
 84    /// Gets or sets the Named Pipe transport options.
 85    /// </summary>
 6586    public NamedPipeTransportOptions? NamedPipeOptions { get; set; }
 87
 88    /// <summary>
 89    /// Gets or sets the default media type to use for responses when no Accept header is provided.
 90    /// </summary>
 091    public Dictionary<string, ICollection<ContentTypeWithSchema>> DefaultResponseMediaType { get; set; } =
 128292        new Dictionary<string, ICollection<ContentTypeWithSchema>> { { "default", new List<ContentTypeWithSchema> { new(
 93
 94    /// <summary>
 95    /// Gets or sets the default media type to use for API responses when no Accept header is provided.
 96    /// </summary>
 097    public Dictionary<string, ICollection<ContentTypeWithSchema>> DefaultApiResponseMediaType { get; set; } =
 128298        new Dictionary<string, ICollection<ContentTypeWithSchema>> { { "default", new List<ContentTypeWithSchema> { new(
 99
 100    /// <summary>
 101    /// Gets or sets the default upload path for form parts.
 102    /// </summary>
 1282103    public string DefaultUploadPath { get; set; } = DefaultUploadPathValue;
 104
 105    /// <summary>
 106    /// Initializes a new instance of the <see cref="KestrunOptions"/> class with default values.
 107    /// </summary>
 1282108    public KestrunOptions()
 109    {
 110        // Set default values if needed
 1282111        MinRunspaces = 1; // Default to 1 runspace
 1282112        Listeners = [];
 1282113        ServerOptions = new KestrelServerOptions();
 1282114        MaxSchedulerRunspaces = 8; // Default max scheduler runspaces
 1282115        ListenUnixSockets = [];
 1282116        NamedPipeNames = [];
 1282117        Health = new HealthEndpointOptions();
 1282118    }
 119}