diff options
| author | Bond_009 <bond.009@outlook.com> | 2019-07-07 18:26:01 +0200 |
|---|---|---|
| committer | Joshua M. Boniface <joshua@boniface.me> | 2019-07-13 17:12:06 -0400 |
| commit | 7bb504d491746d5602b95ab74ed60863cd2e7078 (patch) | |
| tree | fb1f13f621a460ea5897fc12746ddd50d3a60f7d /Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs | |
| parent | b1bd0627098e67169b9ceaa318a32f4d2a9fba30 (diff) | |
Create a new HttpMethod from the function name
Diffstat (limited to 'Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs index 681859f69..613545e21 100644 --- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs @@ -177,10 +177,7 @@ namespace Emby.Server.Implementations.HttpClientManager /// <param name="httpMethod">The HTTP method.</param> /// <returns>Task{HttpResponseInfo}.</returns> public Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod) - { - var httpMethod2 = GetHttpMethod(httpMethod); - return SendAsync(options, httpMethod2); - } + => SendAsync(options, new HttpMethod(httpMethod)); /// <summary> /// send as an asynchronous operation. @@ -216,40 +213,6 @@ namespace Emby.Server.Implementations.HttpClientManager return response; } - private HttpMethod GetHttpMethod(string httpMethod) - { - if (httpMethod.Equals("DELETE", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Delete; - } - else if (httpMethod.Equals("GET", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Get; - } - else if (httpMethod.Equals("HEAD", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Head; - } - else if (httpMethod.Equals("OPTIONS", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Options; - } - else if (httpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Post; - } - else if (httpMethod.Equals("PUT", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Put; - } - else if (httpMethod.Equals("TRACE", StringComparison.OrdinalIgnoreCase)) - { - return HttpMethod.Trace; - } - - throw new ArgumentException("Invalid HTTP method", nameof(httpMethod)); - } - private HttpResponseInfo GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url) { if (File.Exists(responseCachePath) |
