diff options
| author | crobibero <cody@robibe.ro> | 2020-09-03 07:46:52 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-09-03 07:46:52 -0600 |
| commit | fb422ff7411aaedb36d9cb90cc6cc61dd2859a0f (patch) | |
| tree | a40f3d83f025a8227bfcf64c9ad8c93828eb5ba3 /Emby.Server.Implementations/Services/RequestHelper.cs | |
| parent | ae8ff1ca54fd5a4081c2e63a5ea1505ba0a69657 (diff) | |
| parent | a2d6ea2eed58b5cd1ecb519e3eda820f336d5485 (diff) | |
Merge remote-tracking branch 'upstream/master' into http-client-migrate
Diffstat (limited to 'Emby.Server.Implementations/Services/RequestHelper.cs')
| -rw-r--r-- | Emby.Server.Implementations/Services/RequestHelper.cs | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/Emby.Server.Implementations/Services/RequestHelper.cs b/Emby.Server.Implementations/Services/RequestHelper.cs deleted file mode 100644 index 1f9c7fc22..000000000 --- a/Emby.Server.Implementations/Services/RequestHelper.cs +++ /dev/null @@ -1,51 +0,0 @@ -#pragma warning disable CS1591 - -using System; -using System.IO; -using System.Threading.Tasks; -using Emby.Server.Implementations.HttpServer; - -namespace Emby.Server.Implementations.Services -{ - public class RequestHelper - { - public static Func<Type, Stream, Task<object>> GetRequestReader(HttpListenerHost host, string contentType) - { - switch (GetContentTypeWithoutEncoding(contentType)) - { - case "application/xml": - case "text/xml": - case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml - return host.DeserializeXml; - - case "application/json": - case "text/json": - return host.DeserializeJson; - } - - return null; - } - - public static Action<object, Stream> GetResponseWriter(HttpListenerHost host, string contentType) - { - switch (GetContentTypeWithoutEncoding(contentType)) - { - case "application/xml": - case "text/xml": - case "text/xml; charset=utf-8": //"text/xml; charset=utf-8" also matches xml - return host.SerializeToXml; - - case "application/json": - case "text/json": - return host.SerializeToJson; - } - - return null; - } - - private static string GetContentTypeWithoutEncoding(string contentType) - { - return contentType?.Split(';')[0].ToLowerInvariant().Trim(); - } - } -} |
