namespace ReC.Application.Common; public static class HttpExtensions { private static readonly Dictionary _methods = new(StringComparer.OrdinalIgnoreCase) { ["GET"] = HttpMethod.Get, ["POST"] = HttpMethod.Post, ["PUT"] = HttpMethod.Put, ["DELETE"] = HttpMethod.Delete, ["PATCH"] = HttpMethod.Patch, ["HEAD"] = HttpMethod.Head, ["OPTIONS"] = HttpMethod.Options, ["TRACE"] = HttpMethod.Trace, ["CONNECT"] = HttpMethod.Connect }; public static HttpMethod ToHttpMethod(this string method) => _methods.TryGetValue(method, out var httpMethod) ? httpMethod : new HttpMethod(method); }