mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-29 16:38:37 +00:00
Don't log contentLength warnings if the header is null
This commit is contained in:
parent
7eeda59eab
commit
a706ef6836
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@ public static partial class ControllerExtensions
|
||||||
public static async Task<string> ReadBodyAsync(this ControllerBase controller)
|
public static async Task<string> ReadBodyAsync(this ControllerBase controller)
|
||||||
{
|
{
|
||||||
byte[] bodyBytes = await controller.Request.BodyReader.ReadAllAsync();
|
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}, " +
|
Logger.Warn($"Failed to read entire body, contentType={controller.Request.ContentType}, " +
|
||||||
$"contentLen={controller.Request.ContentLength}, readLen={bodyBytes.Length}",
|
$"contentLen={controller.Request.ContentLength}, readLen={bodyBytes.Length}",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue