From a706ef6836cb7fa12aa660727aeb31820535dab2 Mon Sep 17 00:00:00 2001 From: Slendy Date: Fri, 7 Apr 2023 21:00:08 -0500 Subject: [PATCH] Don't log contentLength warnings if the header is null --- ProjectLighthouse/Extensions/ControllerExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ProjectLighthouse/Extensions/ControllerExtensions.cs b/ProjectLighthouse/Extensions/ControllerExtensions.cs index 93c82f2e..f7261dff 100644 --- a/ProjectLighthouse/Extensions/ControllerExtensions.cs +++ b/ProjectLighthouse/Extensions/ControllerExtensions.cs @@ -29,7 +29,7 @@ public static partial class ControllerExtensions public static async Task ReadBodyAsync(this ControllerBase controller) { byte[] bodyBytes = await controller.Request.BodyReader.ReadAllAsync(); - if (bodyBytes.Length != controller.Request.ContentLength) + if (controller.Request.ContentLength != null && bodyBytes.Length != controller.Request.ContentLength) { Logger.Warn($"Failed to read entire body, contentType={controller.Request.ContentType}, " + $"contentLen={controller.Request.ContentLength}, readLen={bodyBytes.Length}",