Merge pull request #838 from Bond-009/requestcleanup

Quick style fix
pull/842/head
Anthony Lavado 6 years ago committed by GitHub
commit d6d9fce898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,9 +86,7 @@ namespace Jellyfin.SocketSharp
private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 }; private static readonly char[] HttpTrimCharacters = new char[] { (char)0x09, (char)0xA, (char)0xB, (char)0xC, (char)0xD, (char)0x20 };
//
// CheckBadChars - throws on invalid chars to be not found in header name/value // CheckBadChars - throws on invalid chars to be not found in header name/value
//
internal static string CheckBadChars(string name) internal static string CheckBadChars(string name)
{ {
if (name == null || name.Length == 0) if (name == null || name.Length == 0)
@ -198,7 +196,10 @@ namespace Jellyfin.SocketSharp
public static string GetResponseContentType(IRequest httpReq) public static string GetResponseContentType(IRequest httpReq)
{ {
var specifiedContentType = GetQueryStringContentType(httpReq); var specifiedContentType = GetQueryStringContentType(httpReq);
if (!string.IsNullOrEmpty(specifiedContentType)) return specifiedContentType; if (!string.IsNullOrEmpty(specifiedContentType))
{
return specifiedContentType;
}
var serverDefaultContentType = "application/json"; var serverDefaultContentType = "application/json";
@ -252,7 +253,10 @@ namespace Jellyfin.SocketSharp
foreach (var contentType in contentTypes) foreach (var contentType in contentTypes)
{ {
if (IsContentType(request, contentType)) return true; if (IsContentType(request, contentType))
{
return true;
}
} }
return false; return false;
@ -274,10 +278,12 @@ namespace Jellyfin.SocketSharp
{ {
return null; return null;
} }
if (pi[0] == '/') if (pi[0] == '/')
{ {
pi = pi.Substring(1); pi = pi.Substring(1);
} }
format = LeftPart(pi, '/'); format = LeftPart(pi, '/');
if (format.Length > formatMaxLength) if (format.Length > formatMaxLength)
{ {
@ -285,7 +291,7 @@ namespace Jellyfin.SocketSharp
} }
} }
format = LeftPart(format, '.').ToLowerInvariant(); format = LeftPart(format, '.');
if (format.Contains("json", StringComparison.OrdinalIgnoreCase)) if (format.Contains("json", StringComparison.OrdinalIgnoreCase))
{ {
return "application/json"; return "application/json";

Loading…
Cancel
Save