diff --git a/src/OpenSearch.Net/Connection/HttpConnection.cs b/src/OpenSearch.Net/Connection/HttpConnection.cs index 57c63a34af..25e9efa3af 100644 --- a/src/OpenSearch.Net/Connection/HttpConnection.cs +++ b/src/OpenSearch.Net/Connection/HttpConnection.cs @@ -27,7 +27,6 @@ */ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; @@ -430,19 +429,17 @@ private static async Task SetContentAsync(HttpRequestMessage message, RequestDat } } - private static System.Net.Http.HttpMethod ConvertHttpMethod(HttpMethod httpMethod) - { - switch (httpMethod) + private static System.Net.Http.HttpMethod ConvertHttpMethod(HttpMethod httpMethod) => + httpMethod switch { - case HttpMethod.GET: return System.Net.Http.HttpMethod.Get; - case HttpMethod.POST: return System.Net.Http.HttpMethod.Post; - case HttpMethod.PUT: return System.Net.Http.HttpMethod.Put; - case HttpMethod.DELETE: return System.Net.Http.HttpMethod.Delete; - case HttpMethod.HEAD: return System.Net.Http.HttpMethod.Head; - default: - throw new ArgumentException("Invalid value for HttpMethod", nameof(httpMethod)); - } - } + HttpMethod.GET => System.Net.Http.HttpMethod.Get, + HttpMethod.POST => System.Net.Http.HttpMethod.Post, + HttpMethod.PUT => System.Net.Http.HttpMethod.Put, + HttpMethod.DELETE => System.Net.Http.HttpMethod.Delete, + HttpMethod.HEAD => System.Net.Http.HttpMethod.Head, + HttpMethod.PATCH => System.Net.Http.HttpMethod.Patch, + _ => throw new ArgumentException("Invalid value for HttpMethod", nameof(httpMethod)) + }; internal static int GetClientKey(RequestData requestData) {