mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Create a new HttpMethod from the function name
This commit is contained in:
parent
b1bd062709
commit
7bb504d491
1 changed files with 1 additions and 38 deletions
|
@ -177,10 +177,7 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
/// <param name="httpMethod">The HTTP method.</param>
|
/// <param name="httpMethod">The HTTP method.</param>
|
||||||
/// <returns>Task{HttpResponseInfo}.</returns>
|
/// <returns>Task{HttpResponseInfo}.</returns>
|
||||||
public Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
|
public Task<HttpResponseInfo> SendAsync(HttpRequestOptions options, string httpMethod)
|
||||||
{
|
=> SendAsync(options, new HttpMethod(httpMethod));
|
||||||
var httpMethod2 = GetHttpMethod(httpMethod);
|
|
||||||
return SendAsync(options, httpMethod2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// send as an asynchronous operation.
|
/// send as an asynchronous operation.
|
||||||
|
@ -216,40 +213,6 @@ namespace Emby.Server.Implementations.HttpClientManager
|
||||||
return response;
|
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)
|
private HttpResponseInfo GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
|
||||||
{
|
{
|
||||||
if (File.Exists(responseCachePath)
|
if (File.Exists(responseCachePath)
|
||||||
|
|
Loading…
Reference in a new issue