Web server - JSON and string inputs also accept PUT

This commit is contained in:
Robert committed 2021-02-19 16:43:19 +01:00
1 parent 4f7e35d167
commit c4b18b699d
2 files changed
+5 -5

No files matched your search

@@ -43,9 +43,9 @@ namespace Artemis.Core.Services
/// <inheritdoc /> /// <inheritdoc />
protected override async Task ProcessRequest(IHttpContext context) protected override async Task ProcessRequest(IHttpContext context)
{ {
if (context.Request.HttpVerb != HttpVerbs.Post) if (context.Request.HttpVerb != HttpVerbs.Post && context.Request.HttpVerb != HttpVerbs.Put)
throw HttpException.MethodNotAllowed("This end point only accepts POST calls"); throw HttpException.MethodNotAllowed("This end point only accepts POST and PUT calls");
context.Response.ContentType = MimeType.Json; context.Response.ContentType = MimeType.Json;
using TextReader reader = context.OpenRequestText(); using TextReader reader = context.OpenRequestText();
@@ -32,8 +32,8 @@ namespace Artemis.Core.Services
/// <inheritdoc /> /// <inheritdoc />
protected override async Task ProcessRequest(IHttpContext context) protected override async Task ProcessRequest(IHttpContext context)
{ {
if (context.Request.HttpVerb != HttpVerbs.Post) if (context.Request.HttpVerb != HttpVerbs.Post && context.Request.HttpVerb != HttpVerbs.Put)
throw HttpException.MethodNotAllowed("This end point only accepts POST calls"); throw HttpException.MethodNotAllowed("This end point only accepts POST and PUT calls");
context.Response.ContentType = MimeType.PlainText; context.Response.ContentType = MimeType.PlainText;