| | | 1 | | namespace Kestrun.Hosting.Options; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Options for configuring status code pages middleware. |
| | | 5 | | /// </summary> |
| | | 6 | | public class StatusCodeOptions |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Initializes a new instance of the <see cref="StatusCodeOptions"/> class. |
| | | 10 | | /// </summary> |
| | | 11 | | /// <param name="host">The KestrunHost instance associated with these options.</param> |
| | 17 | 12 | | public StatusCodeOptions(KestrunHost host) |
| | | 13 | | { |
| | 17 | 14 | | ArgumentNullException.ThrowIfNull(host); |
| | 16 | 15 | | Host = host; |
| | 16 | 16 | | } |
| | | 17 | | /// <summary> |
| | | 18 | | /// Gets the KestrunHost instance associated with these options. |
| | | 19 | | /// </summary> |
| | 3 | 20 | | public KestrunHost Host { get; } |
| | | 21 | | /// <summary> |
| | | 22 | | /// Gets or sets the content type for the status code response. Default is "text/plain". |
| | | 23 | | /// </summary> |
| | 8 | 24 | | public string? ContentType { get; init; } |
| | | 25 | | |
| | | 26 | | /// <summary> |
| | | 27 | | /// Gets or sets the body format string for the status code response. Default is "Status Code: {0}". |
| | | 28 | | /// The format string should contain a single placeholder for the status code. |
| | | 29 | | /// </summary> |
| | 6 | 30 | | public string? BodyFormat { get; init; } |
| | | 31 | | |
| | | 32 | | /// <summary> |
| | | 33 | | /// Gets or sets the script options to execute for generating the status code response. |
| | | 34 | | /// If set, this script will be executed instead of using the BodyFormat. |
| | | 35 | | /// </summary> |
| | 6 | 36 | | public LanguageOptions? LanguageOptions { get; init; } |
| | | 37 | | |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Gets or sets the underlying StatusCodePagesOptions to configure the status code pages middleware. |
| | | 41 | | /// </summary> |
| | 13 | 42 | | public StatusCodePagesOptions? Options { get; init; } |
| | | 43 | | |
| | | 44 | | /// <summary> |
| | | 45 | | /// Gets or sets the location format string for the status code response. If set, the middleware will issue a redire |
| | | 46 | | /// The format string should contain a single placeholder for the status code. |
| | | 47 | | /// If both LocationFormat and PathFormat are set, LocationFormat takes precedence. |
| | | 48 | | /// If neither is set, no redirect will be issued. |
| | | 49 | | /// </summary> |
| | 14 | 50 | | public string? LocationFormat { get; init; } |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Gets or sets the path format string for the status code response. If set, the middleware will re-execute the req |
| | | 54 | | /// The format string should contain a single placeholder for the status code. |
| | | 55 | | /// If both LocationFormat and PathFormat are set, LocationFormat takes precedence. |
| | | 56 | | /// If neither is set, no re-execution will be performed. |
| | | 57 | | /// </summary> |
| | 13 | 58 | | public string? PathFormat { get; init; } |
| | | 59 | | |
| | | 60 | | /// <summary> |
| | | 61 | | /// Gets or sets the query format string for the status code response. If set, the middleware will append the specif |
| | | 62 | | /// The format string should contain a single placeholder for the status code. |
| | | 63 | | /// This is only used if PathFormat is also set. |
| | | 64 | | /// </summary> |
| | 5 | 65 | | public string? QueryFormat { get; init; } |
| | | 66 | | } |