1 override of Body
Microsoft.AspNetCore.Http (1)
214 writes to Body
BasicWebSite (2)
InMemory.FunctionalTests (2)
InProcessWebSite (1)
Microsoft.AspNetCore.Components.Server.Tests (4)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (16)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Connections.Tests (8)
Microsoft.AspNetCore.Http.Extensions.Tests (65)
Microsoft.AspNetCore.Http.Microbenchmarks (1)
Microsoft.AspNetCore.Http.Tests (18)
Microsoft.AspNetCore.HttpLogging (2)
Microsoft.AspNetCore.HttpLogging.Tests (15)
Microsoft.AspNetCore.Mvc.Core.Test (10)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (12)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Mvc.IntegrationTests (37)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (9)
Microsoft.AspNetCore.Owin.Tests (1)
Microsoft.AspNetCore.RequestDecompression (2)
Microsoft.AspNetCore.Routing.FunctionalTests (1)
Microsoft.AspNetCore.Routing.Tests (4)
Microsoft.AspNetCore.TestHost (2)
422 references to Body
BasicWebSite (1)
Binding.Http.IntegrationTests (1)
FormatterWebSite (1)
Http3SampleApp (1)
HttpStress (4)
IIS.Tests (17)
InMemory.FunctionalTests (137)
ChunkedRequestTests.cs (9)
29var count = await request.Body.ReadAsync(buffer, 0, buffer.Length);
63await request.Body.CopyToAsync(data);
261while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
498while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
542while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
587while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
669while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
713while (await request.Body.ReadAsync(buffer, 0, buffer.Length) != 0)
863var readTask = httpContext.Request.Body.CopyToAsync(Stream.Null);
Http2\Http2StreamTests.cs (26)
878var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
880read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
908var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
910read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
956var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
960read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
1050var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1054read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
1151while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1186while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1221while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1257while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1867var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1869read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1912while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
1953var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1955read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
1997while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2058while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2114var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2117read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
3251var readTask = context.Request.Body.ReadAsync(new byte[100], 0, 100).DefaultTimeout();
3293var read = await context.Request.Body.ReadAsync(new byte[100], 0, 100).DefaultTimeout();
3294var readTask = context.Request.Body.ReadAsync(new byte[100], 0, 100).DefaultTimeout();
3429var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length));
3454var thrownExTask = Assert.ThrowsAnyAsync<OperationCanceledException>(() => context.Request.Body.ReadAsync(buffer, 0, buffer.Length));
Http2\Http2TestBase.cs (6)
212await context.Request.Body.CopyToAsync(ms);
241while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
254while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
265while ((received = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length)) > 0)
341received += await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
344var stalledReadTask = context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
Http3\Http3StreamTests.cs (16)
559var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
561read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
588var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
592read = await context.Request.Body.ReadAsync(buffer, total, buffer.Length - total);
1983await c.Request.Body.DrainAsync(default);
2057await c.Request.Body.ReadAsync(data);
2508var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2510read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2546while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2581var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2583read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2618while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2671while (await context.Request.Body.ReadAsync(buffer, 0, buffer.Length) > 0) { }
2719var read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2722read = await context.Request.Body.ReadAsync(buffer, 0, buffer.Length);
2834readCount += await context.Request.Body.ReadAsync(buffer.AsMemory(readCount, 100 - readCount));
MaxRequestBodySizeTests.cs (16)
38async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
79using (var stream = new StreamReader(context.Request.Body))
126using (var stream = new StreamReader(context.Request.Body))
181async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
221Assert.Equal(1, await context.Request.Body.ReadAsync(buffer, 0, 1));
223Assert.Equal(0, await context.Request.Body.ReadAsync(buffer, 0, 1));
251await using (var server = new TestServer(context => context.Request.Body.CopyToAsync(Stream.Null),
291Assert.Equal(1, await context.Request.Body.ReadAsync(buffer, 0, 1));
378async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
380async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
431count = await context.Request.Body.ReadAsync(buffer, 0, 11);
476count = await context.Request.Body.ReadAsync(buffer, offset, 11 - offset);
528count = await context.Request.Body.ReadAsync(buffer, 0, 11);
539count = await context.Request.Body.ReadAsync(buffer, 0, 11);
591async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
593async () => await context.Request.Body.ReadAsync(buffer, 0, 1));
RequestTests.cs (19)
32if (context.Request.Body is MemoryStream)
121await context.Request.Body.FillEntireBufferAsync(data, cts.Token).DefaultTimeout();
135var task = context.Request.Body.ReadAsync(data, 0, data.Length, cts.Token);
925Assert.Equal(0, await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1).DefaultTimeout());
1398if (context.Request.Body != lastStream)
1400lastStream = context.Request.Body;
1415await context.Request.Body.CopyToAsync(ms);
1698var ioEx = Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(new byte[1], 0, 1));
1701var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null));
1706offset += await context.Request.Body.ReadAsync(buffer, offset, 5 - offset);
1709Assert.Equal(0, await context.Request.Body.ReadAsync(new byte[1], 0, 1));
1749offset += context.Request.Body.Read(buffer, offset, 5 - offset);
1752Assert.Equal(0, await context.Request.Body.ReadAsync(new byte[1], 0, 1));
1791var ioEx = Assert.Throws<InvalidOperationException>(() => context.Request.Body.Read(new byte[1], 0, 1));
1794var ioEx2 = Assert.Throws<InvalidOperationException>(() => context.Request.Body.CopyTo(Stream.Null));
1798var length = await context.Request.Body.FillBufferUntilEndAsync(buffer).DefaultTimeout();
1839offset += context.Request.Body.Read(buffer, offset, 5 - offset);
1842Assert.Equal(0, await context.Request.Body.ReadAsync(new byte[1], 0, 1));
1873await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
ResponseTests.cs (9)
344await context.Request.Body.ReadAsync(new byte[1], 0, 1);
361await context.Request.Body.ReadAsync(new byte[1], 0, 1);
487async () => await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1));
1541await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
2039return httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
2109return httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
2155await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1);
2260Assert.Equal(0, await httpContext.Request.Body.ReadAsync(new byte[1], 0, 1).DefaultTimeout());
2330using (var reader = new StreamReader(request.Body, Encoding.ASCII))
InProcessWebSite (31)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (30)
305Assert.NotNull(ctx.Request.Body);
308Assert.Same(body, ctx.Request.Body);
563var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, 1);
566result = await ctx.Request.Body.ReadAsync(readBuffer, 0, 1);
576var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, 4096);
579result = await ctx.Request.Body.ReadAsync(readBuffer, 0, 4096);
590await ctx.Request.Body.ReadAsync(readBuffer, 0, 1);
632var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
636result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
645var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
650result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
667var reader = new StreamReader(ctx.Request.Body);
699var reader = new StreamReader(ctx.Request.Body);
720count += await ctx.Request.Body.ReadAsync(data, count, data.Length - count);
727using (var reader = new StreamReader(ctx.Request.Body))
738var result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
745result = await ctx.Request.Body.ReadAsync(readBuffer, 0, readBuffer.Length);
769await ctx.Request.Body.CopyToAsync(ctx.Response.Body);
775await ctx.Request.Body.ReadAsync(buffer, 0, 6);
776await ctx.Request.Body.ReadAsync(buffer, 6, 5);
788await ctx.Request.Body.ReadAsync(null, 0, 0);
799await ctx.Request.Body.ReadAsync(new byte[1], -1, 0);
810await ctx.Request.Body.ReadAsync(new byte[1], 2, 0);
821await ctx.Request.Body.ReadAsync(new byte[1], 0, -1);
832await ctx.Request.Body.ReadAsync(new byte[1], 0, -1);
843await ctx.Request.Body.ReadAsync(new byte[3], 1, 3);
860count = await ctx.Request.Body.ReadAsync(null, 0, 0);
864count = await ctx.Request.Body.ReadAsync(null, 0, 0);
868count = await ctx.Request.Body.ReadAsync(new byte[1], 0, 0);
872count = await ctx.Request.Body.ReadAsync(new byte[1], 0, 0);
Interop.FunctionalTests (19)
JwtBearerSample (1)
Kestrel.SampleApp (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
Microsoft.AspNetCore.Authentication.WsFederation (1)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (2)
Microsoft.AspNetCore.Grpc.JsonTranscoding (2)
Microsoft.AspNetCore.Http (12)
Microsoft.AspNetCore.Http.Connections (1)
Microsoft.AspNetCore.Http.Extensions (3)
Microsoft.AspNetCore.Http.Extensions.Tests (17)
Microsoft.AspNetCore.Http.Microbenchmarks (3)
Microsoft.AspNetCore.Http.Tests (2)
Microsoft.AspNetCore.HttpLogging (3)
Microsoft.AspNetCore.HttpLogging.Tests (30)
Microsoft.AspNetCore.Mvc.Core (4)
Microsoft.AspNetCore.Mvc.Core.Test (4)
Microsoft.AspNetCore.Mvc.Formatters.Xml (6)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (4)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (8)
Microsoft.AspNetCore.Owin.Tests (1)
Microsoft.AspNetCore.RequestDecompression (2)
Microsoft.AspNetCore.RequestDecompression.Tests (6)
Microsoft.AspNetCore.Routing.FunctionalTests (4)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (58)
Http2Tests.cs (7)
172return httpContext.Request.Body.CopyToAsync(httpContext.Response.Body);
237return httpContext.Request.Body.CopyToAsync(httpContext.Response.Body);
855var readTask = httpContext.Request.Body.ReadAsync(new byte[10], 0, 10);
902var read = await httpContext.Request.Body.ReadAsync(new byte[10], 0, 10);
905var readTask = httpContext.Request.Body.ReadAsync(new byte[10], 0, 10);
951var read = await httpContext.Request.Body.ReadAsync(new byte[10], 0, 10);
954var readTask = httpContext.Request.Body.ReadAsync(new byte[10], 0, 10);
RequestBodyLimitTests.cs (25)
31int read = httpContext.Request.Body.Read(input, 0, input.Length);
54int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
75int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
98int read = httpContext.Request.Body.Read(input, 0, input.Length);
121int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
142int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
165var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
168ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
190var ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
193ex = Assert.Throws<BadHttpRequestException>(() => { var t = httpContext.Request.Body.ReadAsync(input, 0, input.Length); });
215var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
218ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
241var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
244ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
266var ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
269ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
290var body = httpContext.Request.Body;
318int read = httpContext.Request.Body.Read(input, 0, input.Length);
321var ex = Assert.Throws<BadHttpRequestException>(() => httpContext.Request.Body.Read(input, 0, input.Length));
344int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
347var ex = await Assert.ThrowsAsync<BadHttpRequestException>(() => httpContext.Request.Body.ReadAsync(input, 0, input.Length));
370int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
394int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
RequestBodyTests.cs (21)
32int read = httpContext.Request.Body.Read(input, 0, input.Length);
52int read = httpContext.Request.Body.Read(input, 0, 0);
54read = httpContext.Request.Body.Read(input, 0, input.Length);
73int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
91int read = await httpContext.Request.Body.ReadAsync(input, 0, 0);
93read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
110int read = httpContext.Request.Body.EndRead(httpContext.Request.Body.BeginRead(input, 0, input.Length, null, null));
129Assert.Throws<ArgumentNullException>("buffer", () => httpContext.Request.Body.Read(null, 0, 1));
130Assert.Throws<ArgumentOutOfRangeException>("offset", () => httpContext.Request.Body.Read(input, -1, 1));
131Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, input.Length + 1, 1));
132Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 10, -1));
133Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 1, input.Length));
134Assert.Throws<ArgumentOutOfRangeException>("count", () => httpContext.Request.Body.Read(input, 0, input.Length + 1));
152int read = httpContext.Request.Body.Read(input, 0, input.Length);
155read = httpContext.Request.Body.Read(input, 0, input.Length);
173int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
176read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
192int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
194read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
229int read = await httpContext.Request.Body.ReadAsync(input, 0, input.Length);
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (4)
Microsoft.AspNetCore.SpaServices.Extensions (1)
Microsoft.AspNetCore.TestHost.Tests (10)
RequestDecompressionSample (1)
Sockets.FunctionalTests (11)
Wasm.Performance.Driver (1)