From 410032dbbc69e161ace03d68fea1934269c984ba Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 11 Feb 2021 22:21:12 +0800 Subject: ... --- BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs') diff --git a/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs b/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs index 2451ead6..49f8221a 100644 --- a/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs +++ b/BackEnd/Timeline/Formatters/ByteDataInputFormatter.cs @@ -44,6 +44,12 @@ namespace Timeline.Formatters var logger = context.HttpContext.RequestServices.GetRequiredService>(); + if (request.ContentType is null) + { + logger.LogInformation("Failed to read body as bytes. Content-Type is not set."); + return await InputFormatterResult.FailureAsync(); + } + if (contentLength == null) { logger.LogInformation("Failed to read body as bytes. Content-Length is not set."); -- cgit v1.2.3