1 override of ContentLength
Microsoft.AspNetCore.Http (1)
Internal\DefaultHttpRequest.cs (1)
85public override long? ContentLength
21 writes to ContentLength
HttpAbstractions.SampleApp (1)
Program.cs (1)
25request.ContentLength = 10;
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (1)
UnaryServerCallHandlerTests.cs (1)
1194httpContext.Request.ContentLength = requestSize;
Microsoft.AspNetCore.Hosting.Tests (5)
HostingApplicationDiagnosticsTests.cs (5)
246c.Request.ContentLength = 1024; 305c.Request.ContentLength = 1024; 365c.Request.ContentLength = 1024; 420c.Request.ContentLength = 1024; 1055c.Request.ContentLength = 1024;
Microsoft.AspNetCore.Http.Tests (1)
Features\FormFeatureTests.cs (1)
18context.Request.ContentLength = 0;
Microsoft.AspNetCore.Mvc.Core.Test (4)
Formatters\InputFormatterTest.cs (1)
421context.HttpContext.Request.ContentLength = 0;
Formatters\JsonInputFormatterTestBase.cs (1)
643httpContext.Request.ContentLength = requestStream.Length;
Formatters\TextInputFormatterTest.cs (2)
27context.HttpContext.Request.ContentLength = 1; 54context.HttpContext.Request.ContentLength = 1;
Microsoft.AspNetCore.Mvc.IntegrationTests (5)
BodyValidationIntegrationTests.cs (5)
373request.ContentLength = 0; 415request.ContentLength = 0; 449request.ContentLength = 0; 622request.ContentLength = 0; 667request.ContentLength = 0;
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (1)
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (1)
643httpContext.Request.ContentLength = requestStream.Length;
Microsoft.AspNetCore.Rewrite.Tests (1)
IISUrlRewrite\ServerVariableTests.cs (1)
143context.Request.ContentLength = 10;
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
RequestBodyTests.cs (2)
215httpContext.Request.ContentLength = newContentLength; 271httpContext.Request.ContentLength = 789;
61 references to ContentLength
InMemory.FunctionalTests (8)
Http2\Http2StreamTests.cs (2)
187Assert.Equal(11, context.Request.ContentLength); 238Assert.Null(context.Request.ContentLength);
KestrelMetricsTests.cs (1)
921var buffer = new byte[httpContext.Request.ContentLength ?? 0];
src\Servers\Kestrel\shared\test\TestApp.cs (2)
18var buffer = new byte[httpContext.Request.ContentLength ?? 0]; 48var buffer = new byte[httpContext.Request.ContentLength ?? 0];
UpgradeTests.cs (3)
168Assert.Equal(1, context.Request.ContentLength); 202Assert.Equal(0, context.Request.ContentLength); 234Assert.Null(context.Request.ContentLength);
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\JsonRequestHelpers.cs (1)
341var contentLength = serverCallContext.HttpContext.Request.ContentLength.GetValueOrDefault();
Microsoft.AspNetCore.Hosting (3)
Internal\HostingRequestStartingLog.cs (3)
283 => new KeyValuePair<string, object?>(nameof(_request.ContentLength), _request.ContentLength), 48_cachedToString = $"Request starting {request.Protocol} {request.Method} {request.Scheme}://{request.Host.Value}{request.PathBase.Value}{request.Path.Value}{request.QueryString.Value} - {EscapedValueOrEmptyMarker(request.ContentType)} {ValueOrEmptyMarker(request.ContentLength)}";
Microsoft.AspNetCore.Hosting.Tests (1)
Internal\HostingRequestStartLogTests.cs (1)
25mockRequest.Setup(request => request.ContentLength).Returns(0);
Microsoft.AspNetCore.Http (1)
Features\FormFeature.cs (1)
194if (_request.ContentLength == 0)
Microsoft.AspNetCore.Http.Tests (3)
Internal\DefaultHttpRequestTests.cs (3)
24Assert.Equal(value, request.ContentLength); 34Assert.Null(request.ContentLength); 48Assert.Null(request.ContentLength);
Microsoft.AspNetCore.Mvc.Core (3)
Formatters\InputFormatter.cs (1)
98canHaveBody ??= context.HttpContext.Request.ContentLength != 0;
ModelBinding\Binders\BodyModelBinder.cs (2)
136hasBody ??= httpContext.Request.ContentLength is not null && httpContext.Request.ContentLength == 0;
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
XmlDataContractSerializerInputFormatter.cs (1)
123var contentLength = request.ContentLength.GetValueOrDefault();
XmlSerializerInputFormatter.cs (1)
107var contentLength = request.ContentLength.GetValueOrDefault();
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerInputFormatterTest.cs (1)
743request.SetupGet(f => f.ContentLength).Returns(contentBytes.Length);
XmlSerializerInputFormatterTest.cs (1)
679request.SetupGet(f => f.ContentLength).Returns(contentBytes.Length);
Microsoft.AspNetCore.Mvc.IntegrationTests (1)
ModelBindingTestHelper.cs (1)
229public bool CanHaveBody => _context.Request.ContentLength != 0;
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonInputFormatter.cs (1)
123var contentLength = request.ContentLength.GetValueOrDefault();
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
NewtonsoftJsonInputFormatterTest.cs (1)
455httpContext.Setup(h => h.Request.ContentLength).Returns(content.Length);
NewtonsoftJsonPatchInputFormatterTest.cs (1)
263request.SetupGet(f => f.ContentLength).Returns(contentBytes.Length);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (25)
Http2Tests.cs (3)
120Assert.Null(httpContext.Request.ContentLength); 170Assert.Equal(11, httpContext.Request.ContentLength); 234Assert.Null(httpContext.Request.ContentLength);
RequestBodyLimitTests.cs (16)
29Assert.Equal(11, httpContext.Request.ContentLength); 52Assert.Equal(11, httpContext.Request.ContentLength); 73Assert.Equal(11, httpContext.Request.ContentLength); 96Assert.Null(httpContext.Request.ContentLength); 119Assert.Null(httpContext.Request.ContentLength); 140Assert.Null(httpContext.Request.ContentLength); 163Assert.Equal(11, httpContext.Request.ContentLength); 188Assert.Equal(11, httpContext.Request.ContentLength); 213Assert.Equal(11, httpContext.Request.ContentLength); 239Assert.Null(httpContext.Request.ContentLength); 264Assert.Null(httpContext.Request.ContentLength); 288Assert.Null(httpContext.Request.ContentLength); 316Assert.Null(httpContext.Request.ContentLength); 342Assert.Null(httpContext.Request.ContentLength); 368Assert.Equal(12, httpContext.Request.ContentLength); 392Assert.Null(httpContext.Request.ContentLength);
RequestBodyTests.cs (6)
214var newContentLength = httpContext.Request.ContentLength + 1000; 216Assert.Equal(newContentLength, httpContext.Request.ContentLength); 263Assert.Equal(123, httpContext.Request.ContentLength); 266Assert.Equal(456, httpContext.Request.ContentLength); 269Assert.Null(httpContext.Request.ContentLength); 273Assert.Equal(789, httpContext.Request.ContentLength);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (2)
src\Servers\Kestrel\shared\test\TestApp.cs (2)
18var buffer = new byte[httpContext.Request.ContentLength ?? 0]; 48var buffer = new byte[httpContext.Request.ContentLength ?? 0];
Microsoft.AspNetCore.TestHost.Tests (4)
ClientHandlerTests.cs (4)
133Assert.Equal(contentBytes.LongLength, context.Request.ContentLength); 150Assert.Null(context.Request.ContentLength); 166Assert.Null(context.Request.ContentLength); 183Assert.Null(context.Request.ContentLength);
Sockets.FunctionalTests (2)
src\Servers\Kestrel\shared\test\TestApp.cs (2)
18var buffer = new byte[httpContext.Request.ContentLength ?? 0]; 48var buffer = new byte[httpContext.Request.ContentLength ?? 0];