aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Services
diff options
context:
space:
mode:
authorLogicalPhallacy <44458166+LogicalPhallacy@users.noreply.github.com>2019-02-11 22:48:50 -0800
committerGitHub <noreply@github.com>2019-02-11 22:48:50 -0800
commit8bf88f4cb2ddb140baffd8e4542d8f528b482a67 (patch)
tree5f60f345a22c2468b504b925c0bf4785869185ae /Emby.Server.Implementations/Services
parent4519ce26e2250cb233836296d292ddb7b3cf6346 (diff)
parenteb4b7051676b7493a57a99a821d5dd38bd9d4919 (diff)
Merge pull request #9 from jellyfin/master
Yanking in latest changes
Diffstat (limited to 'Emby.Server.Implementations/Services')
-rw-r--r--Emby.Server.Implementations/Services/RequestHelper.cs2
-rw-r--r--Emby.Server.Implementations/Services/ResponseHelper.cs2
-rw-r--r--Emby.Server.Implementations/Services/ServiceExec.cs4
-rw-r--r--Emby.Server.Implementations/Services/ServiceMethod.cs2
-rw-r--r--Emby.Server.Implementations/Services/ServicePath.cs10
-rw-r--r--Emby.Server.Implementations/Services/SwaggerService.cs28
6 files changed, 17 insertions, 31 deletions
diff --git a/Emby.Server.Implementations/Services/RequestHelper.cs b/Emby.Server.Implementations/Services/RequestHelper.cs
index 24e9cbfa4..2563cac99 100644
--- a/Emby.Server.Implementations/Services/RequestHelper.cs
+++ b/Emby.Server.Implementations/Services/RequestHelper.cs
@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Services
{
return contentType == null
? null
- : contentType.Split(';')[0].ToLower().Trim();
+ : contentType.Split(';')[0].ToLowerInvariant().Trim();
}
}
diff --git a/Emby.Server.Implementations/Services/ResponseHelper.cs b/Emby.Server.Implementations/Services/ResponseHelper.cs
index 16de1a083..dc9975347 100644
--- a/Emby.Server.Implementations/Services/ResponseHelper.cs
+++ b/Emby.Server.Implementations/Services/ResponseHelper.cs
@@ -70,7 +70,7 @@ namespace Emby.Server.Implementations.Services
response.ContentType = defaultContentType;
}
- if (new HashSet<string> { "application/json", }.Contains(response.ContentType))
+ if (response.ContentType == "application/json")
{
response.ContentType += "; charset=utf-8";
}
diff --git a/Emby.Server.Implementations/Services/ServiceExec.cs b/Emby.Server.Implementations/Services/ServiceExec.cs
index 45c918fa1..79f5c59e6 100644
--- a/Emby.Server.Implementations/Services/ServiceExec.cs
+++ b/Emby.Server.Implementations/Services/ServiceExec.cs
@@ -23,8 +23,6 @@ namespace Emby.Server.Implementations.Services
"POLL", "SUBSCRIBE", "UNSUBSCRIBE"
};
- public static HashSet<string> AllVerbsSet = new HashSet<string>(AllVerbs);
-
public static List<MethodInfo> GetActions(this Type serviceType)
{
var list = new List<MethodInfo>();
@@ -98,7 +96,7 @@ namespace Emby.Server.Implementations.Services
return Task.FromResult(response);
}
- var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLower();
+ var expectedMethodName = actionName.Substring(0, 1) + actionName.Substring(1).ToLowerInvariant();
throw new NotImplementedException(string.Format("Could not find method named {1}({0}) or Any({0}) on Service {2}", requestDto.GetType().GetMethodName(), expectedMethodName, serviceType.GetMethodName()));
}
diff --git a/Emby.Server.Implementations/Services/ServiceMethod.cs b/Emby.Server.Implementations/Services/ServiceMethod.cs
index 7add72815..5018bf4a2 100644
--- a/Emby.Server.Implementations/Services/ServiceMethod.cs
+++ b/Emby.Server.Implementations/Services/ServiceMethod.cs
@@ -11,7 +11,7 @@ namespace Emby.Server.Implementations.Services
public static string Key(Type serviceType, string method, string requestDtoName)
{
- return serviceType.FullName + " " + method.ToUpper() + " " + requestDtoName;
+ return serviceType.FullName + " " + method.ToUpperInvariant() + " " + requestDtoName;
}
}
}
diff --git a/Emby.Server.Implementations/Services/ServicePath.cs b/Emby.Server.Implementations/Services/ServicePath.cs
index 7e1993b71..f575baca3 100644
--- a/Emby.Server.Implementations/Services/ServicePath.cs
+++ b/Emby.Server.Implementations/Services/ServicePath.cs
@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Services
public static string[] GetPathPartsForMatching(string pathInfo)
{
- return pathInfo.ToLower().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
+ return pathInfo.ToLowerInvariant().Split(new[] { PathSeperatorChar }, StringSplitOptions.RemoveEmptyEntries);
}
public static List<string> GetFirstMatchHashKeys(string[] pathPartsForMatching)
@@ -104,7 +104,7 @@ namespace Emby.Server.Implementations.Services
this.Description = description;
this.restPath = path;
- this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpper().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
+ this.Verbs = string.IsNullOrWhiteSpace(verbs) ? ServiceExecExtensions.AllVerbs : verbs.ToUpperInvariant().Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
var componentsList = new List<string>();
@@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Services
}
else
{
- this.literalsToMatch[i] = component.ToLower();
+ this.literalsToMatch[i] = component.ToLowerInvariant();
if (firstLiteralMatch == null)
{
@@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Services
foreach (var propertyInfo in GetSerializableProperties(RequestType))
{
var propertyName = propertyInfo.Name;
- propertyNamesMap.Add(propertyName.ToLower(), propertyName);
+ propertyNamesMap.Add(propertyName.ToLowerInvariant(), propertyName);
}
}
@@ -483,7 +483,7 @@ namespace Emby.Server.Implementations.Services
continue;
}
- if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out var propertyNameOnRequest))
+ if (!this.propertyNamesMap.TryGetValue(variableName.ToLowerInvariant(), out var propertyNameOnRequest))
{
if (string.Equals("ignore", variableName, StringComparison.OrdinalIgnoreCase))
{
diff --git a/Emby.Server.Implementations/Services/SwaggerService.cs b/Emby.Server.Implementations/Services/SwaggerService.cs
index 9bceeabec..3e6970eef 100644
--- a/Emby.Server.Implementations/Services/SwaggerService.cs
+++ b/Emby.Server.Implementations/Services/SwaggerService.cs
@@ -216,40 +216,28 @@ namespace Emby.Server.Implementations.Services
{
var responses = new Dictionary<string, SwaggerResponse>
{
+ { "200", new SwaggerResponse { description = "OK" } }
};
- responses["200"] = new SwaggerResponse
+ var apiKeySecurity = new Dictionary<string, string[]>
{
- description = "OK"
+ { "api_key", Array.Empty<string>() }
};
- var security = new List<Dictionary<string, string[]>>();
-
- var apiKeySecurity = new Dictionary<string, string[]>();
- apiKeySecurity["api_key"] = Array.Empty<string>();
-
- security.Add(apiKeySecurity);
-
- result[verb.ToLower()] = new SwaggerMethod
+ result[verb.ToLowerInvariant()] = new SwaggerMethod
{
summary = info.Summary,
description = info.Description,
- produces = new[]
- {
- "application/json"
- },
- consumes = new[]
- {
- "application/json"
- },
+ produces = new[] { "application/json" },
+ consumes = new[] { "application/json" },
operationId = info.RequestType.Name,
tags = Array.Empty<string>(),
- parameters = new SwaggerParam[] { },
+ parameters = Array.Empty<SwaggerParam>(),
responses = responses,
- security = security.ToArray()
+ security = new [] { apiKeySecurity }
};
}