From c4b18b699df009b74d335d6d2b155de382d21c97 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 19 Feb 2021 16:43:19 +0100 Subject: [PATCH] Web server - JSON and string inputs also accept PUT --- .../Services/WebServer/EndPoints/JsonPluginEndPoint.cs | 6 +++--- .../Services/WebServer/EndPoints/StringPluginEndPoint.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs index 061bd984e..ffee5bc63 100644 --- a/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs +++ b/src/Artemis.Core/Services/WebServer/EndPoints/JsonPluginEndPoint.cs @@ -43,9 +43,9 @@ namespace Artemis.Core.Services /// protected override async Task ProcessRequest(IHttpContext context) { - if (context.Request.HttpVerb != HttpVerbs.Post) - throw HttpException.MethodNotAllowed("This end point only accepts POST calls"); - + if (context.Request.HttpVerb != HttpVerbs.Post && context.Request.HttpVerb != HttpVerbs.Put) + throw HttpException.MethodNotAllowed("This end point only accepts POST and PUT calls"); + context.Response.ContentType = MimeType.Json; using TextReader reader = context.OpenRequestText(); diff --git a/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs b/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs index b5f65bb2d..b8f996d1c 100644 --- a/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs +++ b/src/Artemis.Core/Services/WebServer/EndPoints/StringPluginEndPoint.cs @@ -32,8 +32,8 @@ namespace Artemis.Core.Services /// protected override async Task ProcessRequest(IHttpContext context) { - if (context.Request.HttpVerb != HttpVerbs.Post) - throw HttpException.MethodNotAllowed("This end point only accepts POST calls"); + if (context.Request.HttpVerb != HttpVerbs.Post && context.Request.HttpVerb != HttpVerbs.Put) + throw HttpException.MethodNotAllowed("This end point only accepts POST and PUT calls"); context.Response.ContentType = MimeType.PlainText;