mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-13 07:00:39 +00:00
Fix JSON IPC POSTs to follow RFC
application/json; charset=utf-8 is valid.
This commit is contained in:
@@ -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<object>(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<object>(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<OrderedDictionary>(false, nameof(request.ContentType) + " must be declared as " + requiredContentType), HttpStatusCode.NotAcceptable).ConfigureAwait(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user