Skip to content

Commit b7b49d5

Browse files
committed
Fix broken header length value
Fixed content.Headers.Length property to calculate and create the header value for Content-Length header if it does not exist.
1 parent bb4bebf commit b7b49d5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nanoFramework.System.Net.Http/Http/Headers/HttpContentHeaders.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ public long ContentLength
3636
{
3737
return Convert.ToInt64(contentLengthValue[0]);
3838
}
39+
40+
if(_content.TryComputeLength(out long computedOrBufferLength))
41+
{
42+
_content.Headers._headerStore.SetAddVerified(HttpKnownHeaderNames.ContentLength, computedOrBufferLength.ToString());
43+
return computedOrBufferLength;
44+
}
3945
}
4046

4147
return -1;

0 commit comments

Comments
 (0)