diff --git a/src/ReC.Domain/Views/ResultView.cs b/src/ReC.Domain/Views/ResultView.cs
index 02adc84..6230184 100644
--- a/src/ReC.Domain/Views/ResultView.cs
+++ b/src/ReC.Domain/Views/ResultView.cs
@@ -1,6 +1,8 @@
using ReC.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
+using System.Net;
+using System.Text.RegularExpressions;
namespace ReC.Domain.Views;
@@ -62,4 +64,34 @@ public class ResultView
[Column("CHANGED_WHEN")]
public DateTime? ChangedWhen { get; set; }
+
+ private static readonly Regex HttpStatusInfoRegex = new(@"^(\d{3})\s+(.+)$", RegexOptions.Compiled);
+
+ ///
+ /// Formats an into a string in the form "statusCode statusName".
+ /// For example, becomes "404 Not Found".
+ ///
+ public static string FormatHttpStatusInfo(HttpStatusCode statusCode)
+ {
+ var code = (int)statusCode;
+ var name = statusCode.ToString();
+ var displayName = Regex.Replace(name, "(?
+ /// Parses an Info string in the form "statusCode statusName" back into its components.
+ /// Returns null if the string does not match the expected format.
+ ///
+ public static (int StatusCode, string StatusName)? ParseHttpStatusInfo(string? info)
+ {
+ if (info is null)
+ return null;
+
+ var match = HttpStatusInfoRegex.Match(info);
+ if (!match.Success)
+ return null;
+
+ return (int.Parse(match.Groups[1].Value), match.Groups[2].Value);
+ }
}
\ No newline at end of file