From e65b7e30d3f4abf98832aacc2361800311ab0e92 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Wed, 20 Jun 2018 01:50:31 +0200 Subject: [PATCH] Fix JSON IPC POSTs to follow RFC application/json; charset=utf-8 is valid. --- ArchiSteamFarm/IPC.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/IPC.cs b/ArchiSteamFarm/IPC.cs index 814081bee..21deef35e 100644 --- a/ArchiSteamFarm/IPC.cs +++ b/ArchiSteamFarm/IPC.cs @@ -244,7 +244,7 @@ namespace ArchiSteamFarm { const string requiredContentType = "application/json"; - if (request.ContentType != requiredContentType) { + if (string.IsNullOrEmpty(request.ContentType) || ((request.ContentType != requiredContentType) && !request.ContentType.StartsWith(requiredContentType + ";", StringComparison.Ordinal))) { await ResponseJsonObject(request, response, new GenericResponse(false, nameof(request.ContentType) + " must be declared as " + requiredContentType), HttpStatusCode.NotAcceptable).ConfigureAwait(false); return true; } @@ -386,7 +386,7 @@ namespace ArchiSteamFarm { const string requiredContentType = "application/json"; - if (request.ContentType != requiredContentType) { + if (string.IsNullOrEmpty(request.ContentType) || ((request.ContentType != requiredContentType) && !request.ContentType.StartsWith(requiredContentType + ";", StringComparison.Ordinal))) { await ResponseJsonObject(request, response, new GenericResponse(false, nameof(request.ContentType) + " must be declared as " + requiredContentType), HttpStatusCode.NotAcceptable).ConfigureAwait(false); return true; } @@ -528,7 +528,7 @@ namespace ArchiSteamFarm { const string requiredContentType = "application/json"; - if (request.ContentType != requiredContentType) { + if (string.IsNullOrEmpty(request.ContentType) || ((request.ContentType != requiredContentType) && !request.ContentType.StartsWith(requiredContentType + ";", StringComparison.Ordinal))) { await ResponseJsonObject(request, response, new GenericResponse(false, nameof(request.ContentType) + " must be declared as " + requiredContentType), HttpStatusCode.NotAcceptable).ConfigureAwait(false); return true; }