1 override of Response
Microsoft.AspNetCore.Http (1)
4009 references to Response
Aspire.Dashboard (15)
AutobahnTestApp (1)
AzureAppServicesHostingStartupSample (25)
AzureAppServicesSample (25)
BasicLinkedApp (1)
BasicWebSite (9)
Benchmarks (2)
Binding.Http.IntegrationTests (2)
blazor-devserver (5)
Certificate.Optional.Sample (2)
Certificate.Sample (1)
ConcurrencyLimiterSample (1)
CookiePolicySample (5)
CookieSample (6)
CookieSessionSample (4)
CorsMiddlewareWebSite (2)
CreateDefaultBuilderApp (1)
CreateDefaultBuilderOfTApp (1)
CustomAuthorizationFailureResponse (5)
DefaultBuilder.SampleApp (21)
DelegationSite (1)
DependencyInjectionApp (2)
Diagnostics.EFCore.FunctionalTests (5)
ExceptionHandlerSample (18)
FormatterWebSite (1)
GenericHostWebSite (2)
GenericWebHost (1)
HeaderPropagationSample (6)
HealthChecksSample (20)
HostFilteringSample (1)
HotAddSample (22)
Http2SampleApp (4)
Http3SampleApp (2)
HttpLogging.Sample (3)
HttpOverridesSample (5)
HttpsPolicySample (1)
HttpStress (13)
IIS.Microbenchmarks (1)
IIS.Tests (10)
IISSample (28)
InMemory.FunctionalTests (861)
Http2\Http2ConnectionTests.cs (47)
61return c.Response.Body.WriteAsync(new byte[1]).AsTask();
93await c.Response.Body.FlushAsync();
96await c.Response.Body.WriteAsync(new byte[65540]);
572await context.Response.WriteAsync("Content");
1181await context.Response.Body.WriteAsync(data, 0, read);
1386await context.Response.BodyWriter.FlushAsync();
1399await context.Response.BodyWriter.WriteAsync(readResult.Buffer.ToArray());
1913await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
1986await context.Response.WriteAsync(new string('!', 65536));
2069await context.Response.Body.WriteAsync(data);
2369c.Response.ContentLength = 0;
2370c.Response.Headers.SetCookie = "SetCookie!";
2371c.Response.Headers.ContentDisposition = "ContentDisposition!";
3213await context.Response.Body.FlushAsync();
3217await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
3220await context.Response.Body.WriteAsync(_maxData, 0, remainingBytesBeforeBackpressure + 1);
3331await context.Response.Body.WriteAsync(_helloWorldBytes, 0, _helloWorldBytes.Length);
3890context.Response.Headers["A"] = new string('a', headerValueLength);
3891context.Response.Headers["B"] = new string('b', headerValueLength);
3892return context.Response.Body.WriteAsync(new byte[payloadLength], 0, payloadLength);
3943return context.Response.Body.WriteAsync(new byte[clientMaxFrame], 0, clientMaxFrame);
4236await context.Response.Body.FlushAsync();
4240await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4243await context.Response.Body.WriteAsync(_maxData, 0, remainingBytesBeforeBackpressure + 1);
4338await context.Response.Body.WriteAsync(_helloWorldBytes, 0, _helloWorldBytes.Length);
4584await context.Response.Body.FlushAsync();
4589await context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4593var lastWriteTask = context.Response.Body.WriteAsync(_maxData, 0, _maxData.Length);
4764await context.Response.Body.WriteAsync(new byte[windowSize - 1], 0, windowSize - 1);
4766await context.Response.Body.WriteAsync(new byte[windowSize], 0, windowSize);
5902var memory = c.Response.BodyWriter.GetMemory();
5903c.Response.BodyWriter.Advance(memory.Length);
5905Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
5907memory = c.Response.BodyWriter.GetMemory();
5908c.Response.BodyWriter.Advance(memory.Length);
5911Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
5913await c.Response.BodyWriter.FlushAsync();
5915Assert.Equal(0, c.Response.BodyWriter.UnflushedBytes);
5955await c.Response.StartAsync();
5958var memory = c.Response.BodyWriter.GetMemory();
5959c.Response.BodyWriter.Advance(memory.Length);
5961Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
5963memory = c.Response.BodyWriter.GetMemory();
5964c.Response.BodyWriter.Advance(memory.Length);
5967Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
5969await c.Response.BodyWriter.FlushAsync();
5971Assert.Equal(0, c.Response.BodyWriter.UnflushedBytes);
Http2\Http2StreamTests.cs (222)
189return context.Request.BodyReader.CopyToAsync(context.Response.BodyWriter);
240return context.Request.BodyReader.CopyToAsync(context.Response.BodyWriter);
360context.Response.Headers["path"] = context.Request.Path.Value;
361context.Response.Headers["query"] = context.Request.QueryString.Value;
362context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
1335context.Response.ContentLength = 11;
1336await context.Response.WriteAsync("hello, world"); // 12
1373context.Response.ContentLength = 11;
1374await context.Response.WriteAsync("hello,");
1375await context.Response.WriteAsync(" world");
1412context.Response.ContentLength = 11;
1446await context.Response.StartAsync();
1480context.Response.ContentLength = 0;
1481await context.Response.StartAsync();
1518await context.Response.StartAsync();
1519ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null));
1555await context.Response.StartAsync();
1556Assert.True(context.Response.HasStarted);
1592await context.Response.StartAsync();
1596await context.Response.WriteAsync("hello, world");
1640await context.Response.StartAsync();
1643await context.Response.Body.FlushAsync();
1678context.Response.ContentLength = 0;
1679await context.Response.StartAsync();
1680await context.Response.WriteAsync("");
1715await context.Response.StartAsync();
1716await context.Response.WriteAsync("hello, world");
1758context.Response.ContentLength = 11;
1759await context.Response.StartAsync();
1793await context.Response.StartAsync();
1826context.Response.ContentLength = 11;
1827return context.Response.WriteAsync("hello,");
2144Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
2145Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type");
2146Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
2147Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
2148await context.Response.WriteAsync("Hello World");
2185Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
2186Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
2187context.Response.ContentType = "Custom 你好 Type";
2188context.Response.Headers.Append("CustomName", "Custom 你好 Value");
2189await context.Response.WriteAsync("Hello World");
2229context.Response.Headers.Append("CustomName", "Custom 你好 Value");
2230await context.Response.WriteAsync("Hello World");
2244context.Response.AppendTrailer("CustomName", "Custom Value");
2282context.Response.AppendTrailer("CustomName", "Custom Value");
2308Assert.True(context.Response.SupportsTrailers(), "SupportsTrailers");
2313context.Response.AppendTrailer("CustomName", "Custom Value");
2360await context.Response.WriteAsync("Hello World");
2361context.Response.AppendTrailer("CustomName", "Custom Value");
2403await context.Response.WriteAsync("Hello World");
2405context.Response.AppendTrailer("CustomName0", largeHeader);
2406context.Response.AppendTrailer("CustomName1", largeHeader);
2407context.Response.AppendTrailer("CustomName2", largeHeader);
2408context.Response.AppendTrailer("CustomName3", largeHeader);
2409context.Response.AppendTrailer("CustomName4", largeHeader);
2411context.Response.AppendTrailer("CustomName5", largeHeader);
2468await context.Response.WriteAsync("Hello World");
2469Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value"));
2470Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value"));
2471Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value"));
2511await context.Response.WriteAsync("Hello World");
2512Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value"));
2513Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value"));
2514context.Response.AppendTrailer("CustomName", "Custom 你好 Value");
2564await context.Response.WriteAsync("Hello World");
2565context.Response.AppendTrailer("CustomName", "Custom 你好 Value");
2596await context.Response.WriteAsync("Hello World");
2597context.Response.AppendTrailer("too_long", trailerValue);
2638await context.Response.WriteAsync("Hello World");
2639context.Response.AppendTrailer("a-key", "a-value");
2640context.Response.AppendTrailer("b-key", "b-value");
2641context.Response.AppendTrailer("too_long", trailerValue);
2731await context.Response.WriteAsync("Hello World");
2732context.Response.AppendTrailer("too_long", trailerValue);
2733context.Response.AppendTrailer("too_long2", trailerValue);
2791await context.Response.WriteAsync("Hello World");
2792context.Response.AppendTrailer("short", shortValue);
2793context.Response.AppendTrailer("long", trailerValue);
2794context.Response.AppendTrailer("short2", shortValue);
2845context.Response.Headers["too_long_header"] = value;
2846await context.Response.WriteAsync("Hello World");
2847context.Response.AppendTrailer("too_long_trailer", value);
2983await context.Response.StartAsync();
2987context.Response.BodyWriter.GetMemory(windowSize + 1);
2988context.Response.BodyWriter.Advance(windowSize + 1);
2990context.Response.AppendTrailer("CustomName", "Custom Value");
3049await context.Response.StartAsync();
3051var s = context.Response.BodyWriter.GetMemory(1);
3053context.Response.BodyWriter.Advance(1);
3055context.Response.AppendTrailer("CustomName", "Custom Value");
3134await context.Response.WriteAsync("hello,");
3193await context.Response.Body.WriteAsync(new byte[10], 0, 10);
3226context.Response.BodyWriter.GetMemory();
3227context.Response.BodyWriter.Advance(10);
3228await context.Response.BodyWriter.FlushAsync();
3259await context.Response.Body.WriteAsync(new byte[10], 0, 10);
3302await context.Response.Body.WriteAsync(new byte[10], 0, 10);
3349await context.Response.Body.WriteAsync(new byte[10], 0, 10);
3386await context.Response.Body.WriteAsync(new byte[10], 0, 10);
3391await context.Response.Body.WriteAsync(new byte[11], 0, 11);
3488await context.Response.Body.WriteAsync(new byte[windowSize + 1], 0, windowSize + 1);
3489context.Response.Body.Write(new byte[1], 0, 1);
3529context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3530await context.Response.WriteAsync("Hello World");
3565context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3566context.Response.Headers.TE = new string('a', 30);
3567await context.Response.WriteAsync("Hello World");
3603context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize);
3604context.Response.Headers.TE = new string('b', (int)Http2PeerSettings.DefaultMaxFrameSize);
3605await context.Response.WriteAsync("Hello World");
3654context.Response.Headers.ETag = new string('a', 17002);
3655await context.Response.WriteAsync("Hello World");
3683context.Response.Headers.ETag = new string('a', (int)Http2PeerSettings.DefaultMaxFrameSize - 20);
3684await context.Response.WriteAsync("Hello World");
3716context.Response.Headers[longHeaderName] = headerValue;
3717await context.Response.WriteAsync("Hello World");
3755context.Response.Headers["my"] = headerValue;
3756await context.Response.WriteAsync("Hello World");
3796await Assert.ThrowsAsync<OperationCanceledException>(() => context.Response.WriteAsync("hello,", new CancellationToken(true)));
3797Assert.False(context.Response.HasStarted);
3830await context.Response.Body.FlushAsync(); // https://github.com/aspnet/KestrelHttpServer/issues/3031
3831var writeTask = context.Response.WriteAsync("hello,", cts.Token);
3876var response = httpContext.Response;
3922var response = httpContext.Response;
3968var response = httpContext.Response;
4020var response = httpContext.Response;
4073var response = httpContext.Response;
4119var response = httpContext.Response;
4169var response = httpContext.Response;
4214var response = httpContext.Response;
4256var response = httpContext.Response;
4300var result = await httpContext.Response.BodyWriter.WriteAsync(payload);
4331httpContext.Response.BodyWriter.CancelPendingFlush();
4333var cancelledResult = await httpContext.Response.BodyWriter.WriteAsync(payload);
4337var goodResult = await httpContext.Response.BodyWriter.WriteAsync(secondPayload);
4373var response = httpContext.Response;
4437var response = httpContext.Response;
4488var response = httpContext.Response;
4534httpContext.Response.ContentLength = 12;
4535await httpContext.Response.Body.WriteAsync(Encoding.ASCII.GetBytes("hello, world"));
4574var response = httpContext.Response;
4638context.Response.BodyWriter.Complete();
4670context.Response.BodyWriter.Complete();
4671writeEx = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.WriteAsync(""));
4704context.Response.BodyWriter.Complete(expectedException);
4743context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
4744await context.Response.CompleteAsync().DefaultTimeout();
4747Assert.True(context.Response.Headers.IsReadOnly);
4796context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
4797context.Response.AppendTrailer("CustomName", "Custom Value");
4799await context.Response.CompleteAsync().DefaultTimeout();
4800await context.Response.CompleteAsync().DefaultTimeout(); // Can be called twice, no-ops
4803Assert.True(context.Response.Headers.IsReadOnly);
4862context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
4864context.Response.ContentLength = 25;
4865context.Response.AppendTrailer("CustomName", "Custom Value");
4867var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.CompleteAsync().DefaultTimeout());
4871Assert.False(context.Response.Headers.IsReadOnly);
4917context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
4919await context.Response.WriteAsync("Hello World");
4921Assert.True(context.Response.Headers.IsReadOnly);
4923await context.Response.CompleteAsync().DefaultTimeout();
4924await context.Response.CompleteAsync().DefaultTimeout(); // Can be called twice, no-ops
4983context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
4984await context.Response.CompleteAsync().DefaultTimeout();
4987Assert.True(context.Response.Headers.IsReadOnly);
4990var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.WriteAsync("2 Hello World").DefaultTimeout());
5039context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5041await context.Response.WriteAsync("Hello World").DefaultTimeout();
5043Assert.True(context.Response.Headers.IsReadOnly);
5045await context.Response.CompleteAsync().DefaultTimeout();
5049var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.WriteAsync("2 Hello World").DefaultTimeout());
5103var memory = context.Response.BodyWriter.GetMemory(12);
5104await context.Response.CompleteAsync();
5107context.Response.BodyWriter.Advance(memory.Length);
5153context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5155var buffer = context.Response.BodyWriter.GetMemory();
5157context.Response.BodyWriter.Advance(length);
5160Assert.False(context.Response.Headers.IsReadOnly);
5162context.Response.AppendTrailer("CustomName", "Custom Value");
5164await context.Response.CompleteAsync().DefaultTimeout();
5166Assert.True(context.Response.Headers.IsReadOnly);
5232context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5234await context.Response.WriteAsync("Hello World");
5236Assert.True(context.Response.Headers.IsReadOnly);
5238context.Response.AppendTrailer("CustomName", "Custom Value");
5240await context.Response.CompleteAsync().DefaultTimeout();
5306context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5308context.Response.ContentLength = 25;
5309await context.Response.WriteAsync("Hello World");
5311Assert.True(context.Response.Headers.IsReadOnly);
5313context.Response.AppendTrailer("CustomName", "Custom Value");
5315var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.CompleteAsync().DefaultTimeout());
5377context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5379context.Response.ContentLength = 25;
5380await context.Response.WriteAsync("Hello World");
5382Assert.True(context.Response.Headers.IsReadOnly);
5384context.Response.AppendTrailer("CustomName", "Custom Value");
5386var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
5447context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5449await context.Response.WriteAsync("Hello World");
5451Assert.True(context.Response.Headers.IsReadOnly);
5453context.Response.AppendTrailer("CustomName", "Custom Value");
5455await context.Response.CompleteAsync().DefaultTimeout();
5529context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5531await context.Response.WriteAsync("Hello World");
5533Assert.True(context.Response.Headers.IsReadOnly);
5535context.Response.AppendTrailer("CustomName", "Custom Value");
5537await context.Response.CompleteAsync().DefaultTimeout();
5611context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5613await context.Response.WriteAsync("Hello World");
5615Assert.True(context.Response.Headers.IsReadOnly);
5617context.Response.AppendTrailer("CustomName", "Custom Value");
5619await context.Response.CompleteAsync().DefaultTimeout();
5695context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
5697await context.Response.WriteAsync("Hello World");
5699Assert.True(context.Response.Headers.IsReadOnly);
5701context.Response.AppendTrailer("CustomName", "Custom Value");
5703await context.Response.CompleteAsync().DefaultTimeout();
5843var response = context.Response;
5895var response = httpContext.Response;
Http3\Http3ConnectionTests.cs (20)
46await context.Response.Body.WriteAsync(buffer, 0, received);
86await context.Response.Body.WriteAsync(buffer, 0, received);
149await context.Response.Body.WriteAsync(buffer, 0, received);
607var memory = c.Response.BodyWriter.GetMemory();
608c.Response.BodyWriter.Advance(memory.Length);
610Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
612memory = c.Response.BodyWriter.GetMemory();
613c.Response.BodyWriter.Advance(memory.Length);
616Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
618await c.Response.BodyWriter.FlushAsync();
620Assert.Equal(0, c.Response.BodyWriter.UnflushedBytes);
658await c.Response.StartAsync();
661var memory = c.Response.BodyWriter.GetMemory();
662c.Response.BodyWriter.Advance(memory.Length);
664Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
666memory = c.Response.BodyWriter.GetMemory();
667c.Response.BodyWriter.Advance(memory.Length);
670Assert.Equal(length, c.Response.BodyWriter.UnflushedBytes);
672await c.Response.BodyWriter.FlushAsync();
674Assert.Equal(0, c.Response.BodyWriter.UnflushedBytes);
Http3\Http3StreamTests.cs (116)
56context.Response.StatusCode = 401;
208context.Response.Headers["path"] = context.Request.Path.Value;
209context.Response.Headers["query"] = context.Request.QueryString.Value;
210context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
658var response = context.Response;
722await context.Response.BodyWriter.FlushAsync();
729await context.Response.BodyWriter.WriteAsync(new byte[] { data[i] });
768var result = await context.Response.BodyWriter.WriteAsync(payload);
797context.Response.BodyWriter.CancelPendingFlush();
799var cancelledResult = await context.Response.BodyWriter.WriteAsync(payload);
803var goodResult = await context.Response.BodyWriter.WriteAsync(secondPayload);
862Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
863Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type");
864Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
865Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
866await context.Response.WriteAsync("Hello World");
896Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
897Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
898context.Response.ContentType = "Custom 你好 Type";
899context.Response.Headers.Append("CustomName", "Custom 你好 Value");
900await context.Response.WriteAsync("Hello World");
931context.Response.Headers.Append("CustomName", "Custom 你好 Value");
932await context.Response.WriteAsync("Hello World");
959await context.Response.WriteAsync("Hello world");
1012await context.Response.WriteAsync("Hello World");
1013Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value"));
1014Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom 你好 Value"));
1015Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value"));
1043await context.Response.WriteAsync("Hello World");
1044Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("Custom你好Name", "Custom Value"));
1045Assert.Throws<InvalidOperationException>(() => context.Response.AppendTrailer("CustomName", "Custom \r Value"));
1046context.Response.AppendTrailer("CustomName", "Custom 你好 Value");
1082await context.Response.WriteAsync("Hello World");
1083context.Response.AppendTrailer("CustomName", "Custom 你好 Value");
1139context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1140await context.Response.CompleteAsync().DefaultTimeout();
1143Assert.True(context.Response.Headers.IsReadOnly);
1185context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1186context.Response.AppendTrailer("CustomName", "Custom Value");
1188await context.Response.CompleteAsync().DefaultTimeout();
1189await context.Response.CompleteAsync().DefaultTimeout(); // Can be called twice, no-ops
1192Assert.True(context.Response.Headers.IsReadOnly);
1237context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1239context.Response.ContentLength = 25;
1240context.Response.AppendTrailer("CustomName", "Custom Value");
1242var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.CompleteAsync().DefaultTimeout());
1246Assert.False(context.Response.Headers.IsReadOnly);
1285context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1287await context.Response.WriteAsync("Hello World");
1289Assert.True(context.Response.Headers.IsReadOnly);
1291await context.Response.CompleteAsync().DefaultTimeout();
1292await context.Response.CompleteAsync().DefaultTimeout(); // Can be called twice, no-ops
1338context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1339await context.Response.CompleteAsync().DefaultTimeout();
1342Assert.True(context.Response.Headers.IsReadOnly);
1345var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.WriteAsync("2 Hello World").DefaultTimeout());
1387context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1389await context.Response.WriteAsync("Hello World").DefaultTimeout();
1391Assert.True(context.Response.Headers.IsReadOnly);
1393await context.Response.CompleteAsync().DefaultTimeout();
1397var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.WriteAsync("2 Hello World").DefaultTimeout());
1437var memory = context.Response.BodyWriter.GetMemory(12);
1438await context.Response.CompleteAsync();
1441context.Response.BodyWriter.Advance(memory.Length);
1480context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1482var buffer = context.Response.BodyWriter.GetMemory();
1484context.Response.BodyWriter.Advance(length);
1487Assert.False(context.Response.Headers.IsReadOnly);
1489context.Response.AppendTrailer("CustomName", "Custom Value");
1491await context.Response.CompleteAsync().DefaultTimeout();
1493Assert.True(context.Response.Headers.IsReadOnly);
1540context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1542await context.Response.WriteAsync("Hello World");
1544Assert.True(context.Response.Headers.IsReadOnly);
1546context.Response.AppendTrailer("CustomName", "Custom Value");
1548await context.Response.CompleteAsync().DefaultTimeout();
1595context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1597context.Response.ContentLength = 25;
1598await context.Response.WriteAsync("Hello World");
1600Assert.True(context.Response.Headers.IsReadOnly);
1602context.Response.AppendTrailer("CustomName", "Custom Value");
1604var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => context.Response.CompleteAsync().DefaultTimeout());
1653context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1655context.Response.ContentLength = 25;
1656await context.Response.WriteAsync("Hello World");
1658Assert.True(context.Response.Headers.IsReadOnly);
1660context.Response.AppendTrailer("CustomName", "Custom Value");
1662var ex = Assert.Throws<InvalidOperationException>(() => context.Response.BodyWriter.Complete());
1710context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1712await context.Response.WriteAsync("Hello World");
1714Assert.True(context.Response.Headers.IsReadOnly);
1716context.Response.AppendTrailer("CustomName", "Custom Value");
1718await context.Response.CompleteAsync().DefaultTimeout();
1771context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1773await context.Response.WriteAsync("Hello World");
1775Assert.True(context.Response.Headers.IsReadOnly);
1777context.Response.AppendTrailer("CustomName", "Custom Value");
1779await context.Response.CompleteAsync().DefaultTimeout();
1833context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1835await context.Response.WriteAsync("Hello World");
1837Assert.True(context.Response.Headers.IsReadOnly);
1839context.Response.AppendTrailer("CustomName", "Custom Value");
1841await context.Response.CompleteAsync().DefaultTimeout();
1898context.Response.OnStarting(() => { startingTcs.SetResult(); return Task.CompletedTask; });
1900await context.Response.WriteAsync("Hello World");
1902Assert.True(context.Response.Headers.IsReadOnly);
1904context.Response.AppendTrailer("CustomName", "Custom Value");
1906await context.Response.CompleteAsync().DefaultTimeout();
2014await c.Response.Body.FlushAsync();
2789context.Response.Headers["BigHeader"] = new string('!', 100);
2837await context.Response.Body.WriteAsync(buffer.AsMemory(0, 100));
2901c.Response.Headers["Header" + i] = i + "-" + headerText;
2941c.Response.AppendTrailer("Header" + i, i + "-" + headerText);
2996var memory = context.Response.BodyWriter.GetMemory(sizeHint);
2999await context.Response.CompleteAsync();
3000context.Response.BodyWriter.Advance(memory.Length);
ResponseHeaderTests.cs (23)
23Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
24Assert.Throws<InvalidOperationException>(() => context.Response.ContentType = "Custom 你好 Type"); // Special cased
25Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Accept = "Custom 你好 Accept"); // Not special cased
26Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom 你好 Value"));
27Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
28context.Response.ContentLength = 11;
29return context.Response.WriteAsync("Hello World");
54Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("Custom你好Name", "Custom Value"));
55Assert.Throws<InvalidOperationException>(() => context.Response.Headers.Append("CustomName", "Custom \r Value"));
56context.Response.ContentType = "Custom 你好 Type";
57context.Response.Headers.Accept = "Custom 你好 Accept";
58context.Response.Headers.Append("CustomName", "Custom 你好 Value");
59context.Response.ContentLength = 11;
60return context.Response.WriteAsync("Hello World");
91context.Response.Headers.Append("CustomName", "Custom 你好 Value");
92context.Response.ContentLength = 11;
93return context.Response.WriteAsync("Hello World");
112Assert.Equal(0, context.Response.Headers[tag].Count);
114context.Response.Headers.Add(tag, new StringValues((string)null));
116Assert.Equal(0, context.Response.Headers[tag].Count);
119context.Response.Headers.Add(tag, new StringValues("Hello"));
121context.Response.ContentLength = 11;
122return context.Response.WriteAsync("Hello World");
ResponseTests.cs (239)
43context.Response.OnStarting(() => Task.Run(() => onStartingCalled = true));
44context.Response.OnCompleted(() => Task.Run(() =>
81await context.Response.WriteAsync("hello, world");
82await context.Response.BodyWriter.FlushAsync();
83ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null));
116await context.Response.StartAsync();
117ex = Assert.Throws<InvalidOperationException>(() => context.Response.OnStarting(_ => Task.CompletedTask, null));
156await context.Response.WriteAsync("hello", cts.Token).DefaultTimeout();
161var writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout();
168writeTask = context.Response.BodyWriter.WriteAsync(new Memory<byte>(data, 0, data.Length), cts.Token).AsTask().DefaultTimeout();
223var result = await context.Response.BodyWriter.WriteAsync(payload);
248context.Response.BodyWriter.CancelPendingFlush();
250var cancelledResult = await context.Response.BodyWriter.WriteAsync(payload);
254var goodResult = await context.Response.BodyWriter.WriteAsync(secondPayload);
377context.Response.OnCompleted(_ => throw new Exception(), null);
378await context.Response.WriteAsync("hello, world");
409context.Response.OnCompleted(async () =>
413await context.Response.WriteAsync("hello, world");
446httpContext.Response.OnCompleted(() => Task.Run(() =>
520await httpContext.Response.WriteAsync("hello, ");
521await httpContext.Response.WriteAsync("world");
554httpContext.Response.StatusCode = statusCode;
579httpContext.Response.StatusCode = 205;
679httpContext.Response.StatusCode = statusCode;
680httpContext.Response.Headers.ContentLength = 1;
684await httpContext.Response.StartAsync();
717httpContext.Response.StatusCode = statusCode;
718httpContext.Response.Headers.ContentLength = 0;
722await httpContext.Response.StartAsync();
757httpContext.Response.StatusCode = 205;
758httpContext.Response.Headers.ContentLength = 1;
762await httpContext.Response.StartAsync();
796httpContext.Response.StatusCode = statusCode;
800await httpContext.Response.WriteAsync("hello, world");
838httpContext.Response.StatusCode = 205;
842await httpContext.Response.WriteAsync("hello, world");
915await httpContext.Response.WriteAsync(response);
916await httpContext.Response.BodyWriter.FlushAsync();
959httpContext.Response.ContentLength = 11;
960await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("hello,"), 0, 6));
961await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes(" world"), 0, 6));
1000httpContext.Response.ContentLength = 11;
1001await httpContext.Response.WriteAsync("hello,");
1002await httpContext.Response.WriteAsync(" world");
1040httpContext.Response.ContentLength = 5;
1041await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1075httpContext.Response.ContentLength = 5;
1076await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1117httpContext.Response.ContentLength = 13;
1118await httpContext.Response.WriteAsync("hello, world");
1171httpContext.Response.ContentLength = 13;
1172await httpContext.Response.WriteAsync("hello, world");
1174completeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Complete());
1225httpContext.Response.ContentLength = 12;
1226await httpContext.Response.WriteAsync("hello,");
1267httpContext.Response.ContentLength = 5;
1308httpContext.Response.ContentLength = 0;
1312await httpContext.Response.BodyWriter.FlushAsync();
1346httpContext.Response.Headers["Transfer-Encoding"] = "chunked";
1347httpContext.Response.ContentLength = 13;
1348await httpContext.Response.WriteAsync("hello, world");
1382httpContext.Response.Headers["Transfer-Encoding"] = "chunked";
1383httpContext.Response.ContentLength = 11;
1384await httpContext.Response.WriteAsync("hello, world");
1412httpContext.Response.ContentLength = 42;
1440httpContext.Response.ContentLength = 12;
1441await httpContext.Response.WriteAsync("hello, world");
1473httpContext.Response.ContentLength = 12;
1474await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("hello, world"), 0, 12));
1504httpContext.Response.ContentLength = 12;
1505await httpContext.Response.WriteAsync("");
1507await httpContext.Response.WriteAsync("hello, world");
1546httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1547httpContext.Response.ContentLength = ex.Message.Length;
1548await httpContext.Response.WriteAsync(ex.Message);
1579httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding;
1580await httpContext.Response.WriteAsync("hello, world");
1624httpContext.Response.Headers["Connection"] = "keep-alive";
1625httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding;
1626await httpContext.Response.WriteAsync("hello, world");
1670httpContext.Response.Headers["Transfer-Encoding"] = responseTransferEncoding;
1673await httpContext.Response.WriteAsync("hello, world");
1713httpContext.Response.OnStarting(() =>
1716httpContext.Response.ContentLength = null;
1721httpContext.Response.ContentLength = response.Length - 1;
1724await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length));
1755httpContext.Response.OnStarting(() =>
1758httpContext.Response.ContentLength = null;
1763httpContext.Response.ContentLength = response.Length - 1;
1766await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length));
1797httpContext.Response.OnStarting(() =>
1800httpContext.Response.ContentLength = null;
1805httpContext.Response.ContentLength = response.Length - 1;
1808await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1809await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
1842httpContext.Response.OnStarting(() =>
1845httpContext.Response.ContentLength = null;
1850httpContext.Response.ContentLength = response.Length - 1;
1853await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1854await httpContext.Response.Body.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
1885httpContext.Response.OnStarting(() =>
1888httpContext.Response.ContentLength = null;
1893httpContext.Response.ContentLength = response.Length - 1;
1896return httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length)).AsTask();
1925httpContext.Response.OnStarting(() =>
1928httpContext.Response.ContentLength = null;
1933httpContext.Response.ContentLength = response.Length - 1;
1936await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, 0, response.Length / 2));
1937await httpContext.Response.BodyWriter.WriteAsync(new Memory<byte>(response, response.Length / 2, response.Length - response.Length / 2));
1968await httpContext.Response.WriteAsync("hello, world");
2156await httpContext.Response.WriteAsync("hello, world");
2328var response = httpContext.Response;
2426var response = httpContext.Response;
2481var response = httpContext.Response;
2535var response = httpContext.Response;
2580var response = httpContext.Response;
2630var response = httpContext.Response;
2682var response = httpContext.Response;
2727var response = httpContext.Response;
2768var response = httpContext.Response;
2934await httpContext.Response.StartAsync();
2963httpContext.Response.ContentLength = 0;
2964await httpContext.Response.StartAsync();
2965await httpContext.Response.WriteAsync("");
2991await httpContext.Response.StartAsync();
2992await httpContext.Response.WriteAsync("");
3021await httpContext.Response.StartAsync();
3022await httpContext.Response.WriteAsync("Hello World!");
3053await httpContext.Response.StartAsync();
3054Assert.True(httpContext.Response.HasStarted);
3083await httpContext.Response.StartAsync();
3111httpContext.Response.ContentLength = 11;
3112await httpContext.Response.StartAsync();
3142await httpContext.Response.StartAsync();
3143Assert.True(httpContext.Response.HasStarted);
3178httpContext.Response.Headers["Content-Length"] = new[] { "11" };
3179await httpContext.Response.StartAsync();
3180await httpContext.Response.WriteAsync("Hello World");
3181Assert.True(httpContext.Response.HasStarted);
3209httpContext.Response.ContentLength = expectedLength;
3210await httpContext.Response.WriteAsync(expectedString);
3211Assert.True(httpContext.Response.HasStarted);
3255httpContext.Response.ContentLength = expectedLength;
3257WriteStringWithoutFlushing(httpContext.Response.BodyWriter, expectedString);
3259Assert.False(httpContext.Response.HasStarted);
3287await httpContext.Response.StartAsync();
3288await httpContext.Response.BodyWriter.FlushAsync();
3289Assert.True(httpContext.Response.HasStarted);
3323context.Response.OnStarting(_ =>
3329context.Response.OnStarting(_ =>
3335context.Response.ContentLength = response.Length;
3336await context.Response.WriteAsync(response);
3374context.Response.OnCompleted(_ =>
3380context.Response.OnCompleted(_ =>
3386context.Response.ContentLength = response.Length;
3387await context.Response.WriteAsync(response);
3421context.Response.ContentLength = 6;
3424var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6));
3426await context.Response.Body.WriteAsync(Encoding.ASCII.GetBytes("Hello1"), 0, 6);
3451context.Response.ContentLength = 6;
3452context.Response.Body.Write(Encoding.ASCII.GetBytes("Hello1"), 0, 6);
3482context.Response.ContentLength = 6;
3483context.Response.Body.Write(Encoding.ASCII.GetBytes("Hello!"), 0, 6);
3517context.Response.ContentLength = 6;
3520var ioEx = Assert.Throws<InvalidOperationException>(() => context.Response.Body.Write(Encoding.ASCII.GetBytes("What!?"), 0, 6));
3523return context.Response.BodyWriter.WriteAsync(new Memory<byte>(Encoding.ASCII.GetBytes("Hello!"), 0, 6)).AsTask();
3548var response = httpContext.Response;
3579var response = httpContext.Response;
3612var response = httpContext.Response;
3642var response = httpContext.Response;
3674var response = httpContext.Response;
3712var response = httpContext.Response;
3749httpContext.Response.ContentLength = 12;
3750await httpContext.Response.Body.WriteAsync(Encoding.ASCII.GetBytes("hello, world"));
3775var response = httpContext.Response;
3817httpContext.Response.BodyWriter.Complete();
3845httpContext.Response.BodyWriter.Complete();
3846writeEx = await Assert.ThrowsAsync<InvalidOperationException>(() => httpContext.Response.WriteAsync("test"));
3876await httpContext.Response.WriteAsync("hello, world");
3877await httpContext.Response.BodyWriter.CompleteAsync();
3914var memory = httpContext.Response.BodyWriter.GetMemory();
3916httpContext.Response.BodyWriter.Advance(1);
3917await httpContext.Response.BodyWriter.FlushAsync();
3960var memory = httpContext.Response.BodyWriter.GetMemory();
3962httpContext.Response.BodyWriter.Advance(1);
3963await httpContext.Response.BodyWriter.FlushAsync();
4012httpContext.Response.ContentLength = 1;
4013var memory = httpContext.Response.BodyWriter.GetMemory();
4015httpContext.Response.BodyWriter.Advance(1);
4016await httpContext.Response.BodyWriter.FlushAsync();
4020var memory = httpContext.Response.BodyWriter.GetMemory();
4022httpContext.Response.BodyWriter.Advance(1);
4023await httpContext.Response.BodyWriter.FlushAsync();
4073Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1));
4077var memory = httpContext.Response.BodyWriter.GetMemory();
4116httpContext.Response.BodyWriter.Complete(expectedException);
4144await httpContext.Response.StartAsync();
4145httpContext.Response.BodyWriter.Complete();
4146var memory = httpContext.Response.BodyWriter.GetMemory(); // Shouldn't throw
4176httpContext.Response.BodyWriter.Complete();
4177var memory = httpContext.Response.BodyWriter.GetMemory(); // Shouldn't throw
4205var memory = httpContext.Response.BodyWriter.GetMemory();
4208await httpContext.Response.StartAsync();
4211memory = httpContext.Response.BodyWriter.GetMemory();
4240var memory = httpContext.Response.BodyWriter.GetMemory();
4242await httpContext.Response.StartAsync();
4244Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.Advance(1));
4274httpContext.Response.BodyWriter.Complete();
4276writeEx = Assert.Throws<InvalidOperationException>(() => httpContext.Response.BodyWriter.GetMemory());
4305httpContext.Response.Body = new MemoryStream();
4306var BodyWriter1 = httpContext.Response.BodyWriter;
4308httpContext.Response.Body = new MemoryStream();
4309var BodyWriter2 = httpContext.Response.BodyWriter;
4337var oldBody = httpContext.Response.Body;
4338httpContext.Response.Body = new MemoryStream();
4340await httpContext.Response.BodyWriter.WriteAsync(new byte[1]);
4341await httpContext.Response.Body.WriteAsync(new byte[1]);
4343Assert.Equal(2, httpContext.Response.Body.Length);
4345httpContext.Response.Body = oldBody;
4371httpContext.Response.Headers.AltSvc = "Custom";
4579var memory = context.Response.BodyWriter.GetMemory();
4580context.Response.BodyWriter.Advance(memory.Length);
4582Assert.Equal(length, context.Response.BodyWriter.UnflushedBytes);
4584memory = context.Response.BodyWriter.GetMemory();
4585context.Response.BodyWriter.Advance(memory.Length);
4588Assert.Equal(length, context.Response.BodyWriter.UnflushedBytes);
4590await context.Response.BodyWriter.FlushAsync();
4592Assert.Equal(0, context.Response.BodyWriter.UnflushedBytes);
4628await context.Response.StartAsync();
4631await context.Response.BodyWriter.FlushAsync();
4634var memory = context.Response.BodyWriter.GetMemory();
4635context.Response.BodyWriter.Advance(memory.Length);
4637Assert.Equal(length, context.Response.BodyWriter.UnflushedBytes);
4639memory = context.Response.BodyWriter.GetMemory();
4640context.Response.BodyWriter.Advance(memory.Length);
4644Assert.Equal(length + 7, context.Response.BodyWriter.UnflushedBytes);
4646await context.Response.BodyWriter.FlushAsync();
4648Assert.Equal(0, context.Response.BodyWriter.UnflushedBytes);
4692disposedTcs.TrySetResult(c.Response.StatusCode);
InProcessWebSite (149)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (145)
58private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath);
60private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().WebRootPath);
67private async Task CurrentDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.CurrentDirectory);
69private async Task BaseDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(AppContext.BaseDirectory);
75await ctx.Response.WriteAsync("IIS Version: " + config["IIS_VERSION"] + Environment.NewLine);
76await ctx.Response.WriteAsync("ApplicationId: " + config["IIS_APPLICATION_ID"] + Environment.NewLine);
77await ctx.Response.WriteAsync("Application Path: " + config["IIS_PHYSICAL_PATH"] + Environment.NewLine);
78await ctx.Response.WriteAsync("Application Virtual Path: " + config["IIS_APPLICATION_VIRTUAL_PATH"] + Environment.NewLine);
79await ctx.Response.WriteAsync("Application Config Path: " + config["IIS_APP_CONFIG_PATH"] + Environment.NewLine);
80await ctx.Response.WriteAsync("AppPool ID: " + config["IIS_APP_POOL_ID"] + Environment.NewLine);
81await ctx.Response.WriteAsync("AppPool Config File: " + config["IIS_APP_POOL_CONFIG_FILE"] + Environment.NewLine);
82await ctx.Response.WriteAsync("Site ID: " + config["IIS_SITE_ID"] + Environment.NewLine);
83await ctx.Response.WriteAsync("Site Name: " + config["IIS_SITE_NAME"]);
103private async Task ASPNETCORE_IIS_PHYSICAL_PATH(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.GetEnvironmentVariable("ASPNETCORE_IIS_PHYSICAL_PATH"));
108await ctx.Response.WriteAsync(string.Join(",", serverAddresses.Addresses));
113await ctx.Response.WriteAsync(ctx.Request.Protocol);
120await ctx.Response.WriteAsync("Hello World");
127await ctx.Response.WriteAsync("Hello World");
135await ctx.Response.WriteAsync(authScheme?.Name ?? "null");
138await ctx.Response.WriteAsync(":" + ctx.User.Identity.Name);
145await context.Response.WriteAsync(clientCert != null ? $"Enabled;{clientCert.GetCertHashString()}" : "Disabled");
172await context.Response.WriteAsync(_waitingRequestCount.ToString(CultureInfo.InvariantCulture));
194context.Response.Headers["connection"] = "close";
200context.Response.Headers["Server"] = "MyServer/7.8";
211context.Response.ContentType = "text/html";
212await context.Response.Body.WriteAsync(new byte[100], 0, 100);
218await ctx.Response.WriteAsync(Environment.GetEnvironmentVariable(ctx.Request.Query["name"].ToString()));
230await ctx.Response.WriteAsync($"{varName}: {feature[varName] ?? "(null)"}");
235await ctx.Response.WriteAsync("Anonymous?" + !ctx.User.Identity.IsAuthenticated);
242await ctx.Response.WriteAsync(ctx.User.Identity.AuthenticationType);
259await ctx.Response.WriteAsync("NTLM");
269return ctx.Response.WriteAsync($"PathBase: {ctx.Request.PathBase.Value}; Path: {ctx.Request.Path.Value}");
316await ctx.Response.WriteAsync("Success");
321ctx.Response.StatusCode = 500;
322await ctx.Response.WriteAsync(exception.ToString());
324await ctx.Response.WriteAsync("_Failure");
331Assert.Equal(200, ctx.Response.StatusCode);
332ctx.Response.StatusCode = 404;
333Assert.Equal(404, ctx.Response.StatusCode);
334ctx.Response.StatusCode = 200;
340Assert.NotNull(ctx.Response.Headers);
345var originalBody = ctx.Response.Body;
348ctx.Response.Body = body;
349Assert.Same(body, ctx.Response.Body);
350ctx.Response.Body = originalBody;
352await ctx.Response.WriteAsync("Success");
357ctx.Response.StatusCode = 500;
358await ctx.Response.WriteAsync(exception.ToString());
360await ctx.Response.WriteAsync("_Failure");
374await ctx.Response.WriteAsync("Success");
379ctx.Response.StatusCode = 500;
380await ctx.Response.WriteAsync(exception.ToString());
382await ctx.Response.WriteAsync("_Failure");
397await ctx.Response.WriteAsync(ctx.Request.Query["body"]);
405await ctx.Response.WriteAsync(ctx.Request.Path.Value);
410await ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
414await ctx.Response.WriteAsync("Hello World");
421await ctx.Response.WriteAsync(new string('a', length));
449ctx.Response.Headers["UnknownHeader"] = "test123=foo";
450ctx.Response.ContentType = "text/plain";
451ctx.Response.Headers["MultiHeader"] = new StringValues(new string[] { "1", "2" });
452await ctx.Response.WriteAsync("Request Complete");
457ctx.Response.Headers["EmptyHeader"] = "";
458await ctx.Response.WriteAsync("EmptyHeaderShouldBeSkipped");
470return ctx.Response.WriteAsync($"Failure: '{headerName}' indexer");
474return ctx.Response.WriteAsync($"Failure: '{headerName}' TryGetValue");
498return ctx.Response.WriteAsync($"Failure: Repeated '{headerName}' Add did not throw");
515return ctx.Response.WriteAsync("Success");
522await ctx.Response.WriteAsync("Started_");
525ctx.Response.StatusCode = 200;
529await ctx.Response.WriteAsync("SetStatusCodeAfterWriteThrew_");
531await ctx.Response.WriteAsync("Finished");
536await ctx.Response.WriteAsync("Started_");
539ctx.Response.Headers["This will fail"] = "some value";
543await ctx.Response.WriteAsync("SetHeaderAfterWriteThrew_");
545await ctx.Response.WriteAsync("Finished");
587await ctx.Response.WriteAsync(_requestsInFlight.ToString(CultureInfo.InvariantCulture));
592await ctx.Response.WriteAsync("done");
598await ctx.Response.WriteAsync("test1");
605await ctx.Response.WriteAsync("test2");
614ctx.Response.ContentLength = 9;
615await ctx.Response.WriteAsync("Completed");
622await ctx.Response.WriteAsync("hello world");
635await ctx.Response.WriteAsync(Encoding.UTF8.GetString(readBuffer, 0, result));
648await ctx.Response.WriteAsync(Encoding.UTF8.GetString(readBuffer, 0, result));
649await ctx.Response.Body.FlushAsync();
661ctx.Response.ContentType = contentType;
665await ctx.Response.Body.FlushAsync();
675await ctx.Response.WriteAsync(line + Environment.NewLine);
676await ctx.Response.Body.FlushAsync();
693ctx.Response.ContentType = contentType;
697await ctx.Response.Body.FlushAsync();
707await ctx.Response.WriteAsync(line + Environment.NewLine);
722await ctx.Response.Body.WriteAsync(data, 0, data.Length);
730ctx.Response.Headers["BodyAsString"] = value;
731await ctx.Response.WriteAsync(value);
741await ctx.Response.WriteAsync(Encoding.UTF8.GetString(readBuffer, 0, result));
742await ctx.Response.Body.FlushAsync();
743await ctx.Response.WriteAsync(Encoding.UTF8.GetString(readBuffer, 0, result));
744await ctx.Response.Body.FlushAsync();
760await ctx.Response.WriteAsync("hello world");
769await ctx.Request.Body.CopyToAsync(ctx.Response.Body);
778await ctx.Response.WriteAsync(Encoding.UTF8.GetString(buffer));
851await ctx.Response.WriteAsync(success ? "Success" : "Failure");
875await ctx.Response.WriteAsync(count == 0 ? "Success" : "Failure");
886await ctx.Response.Body.WriteAsync(new byte[1], -1, 0);
897await ctx.Response.Body.WriteAsync(new byte[1], 2, 0);
908await ctx.Response.Body.WriteAsync(new byte[1], 0, -1);
919await ctx.Response.Body.WriteAsync(new byte[1], 0, -1);
930await ctx.Response.Body.WriteAsync(new byte[3], 1, 3);
938await ctx.Response.WriteAsync(success ? "Success" : "Failure");
945await ctx.Response.Body.WriteAsync(null, 0, 0);
949await ctx.Response.Body.WriteAsync(null, 0, 0);
952await ctx.Response.WriteAsync("Success");
967await ctx.Response.SendFileAsync(tempFile, 0, null);
983await ctx.Response.WriteAsync(AppDomain.CurrentDomain.BaseDirectory);
989return ctx.Response.WriteAsync(ctx.Request.Path.Value);
994await ctx.Response.WriteAsync("Shutting down");
1004await ctx.Response.WriteAsync("Shutting down");
1011await ctx.Response.WriteAsync("Shutting down");
1022await ctx.Response.WriteAsync("Hello World");
1029await ctx.Response.WriteAsync("Hello World");
1043await ctx.Response.WriteAsync(StartupHookCalled.ToString());
1053await ctx.Response.WriteAsync("Response Begin");
1056await ctx.Response.WriteAsync(serverVariableFeature["REMOTE_PORT"]);
1057await ctx.Response.Body.FlushAsync();
1059await ctx.Response.WriteAsync("Response End");
1064await ctx.Response.WriteAsync(string.Join("|", Environment.GetCommandLineArgs().Skip(1)));
1068ctx.Response.WriteAsync("Scheme:" + ctx.Request.Scheme + "; Original:" + ctx.Request.Headers["x-original-proto"]);
1070public Task Path(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.Path.Value);
1072public Task Query(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.QueryString.Value);
1074public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString(CultureInfo.InvariantCulture) ?? "null");
1076public Task Anonymous(HttpContext context) => context.Response.WriteAsync("Anonymous?" + !context.User.Identity.IsAuthenticated);
1083return context.Response.WriteAsync(context.User.Identity.AuthenticationType);
1097return context.Response.WriteAsync("NTLM");
1106context.Response.WriteAsync(context.Features.Get<IHttpUpgradeFeature>() != null ? "Enabled" : "Disabled");
1120return context.Response.WriteAsync("Hello World");
1123return context.Response.WriteAsync(context.Request.Headers["ANCMRHPath"]);
1128await context.Response.WriteAsync(Environment.ProcessId.ToString(CultureInfo.InvariantCulture));
1135await context.Response.WriteAsync(httpsPort.HasValue ? httpsPort.Value.ToString(CultureInfo.InvariantCulture) : "NOVALUE");
1142await context.Response.WriteAsync(httpsPort.HasValue ? httpsPort.Value.ToString(CultureInfo.InvariantCulture) : "NOVALUE");
1172ctx.Response.StatusCode = 500;
1173await ctx.Response.WriteAsync(exception.ToString());
1193ctx.Response.StatusCode = 500;
1194await ctx.Response.WriteAsync(exception.ToString());
Interop.FunctionalTests (83)
JwtBearerSample (1)
JwtSample (1)
Kestrel.SampleApp (3)
LargeResponseApp (3)
LocalizationSample (51)
Startup.cs (51)
37context.Response.StatusCode = 404;
41context.Response.StatusCode = 200;
42context.Response.ContentType = "text/html; charset=utf-8";
47await context.Response.WriteAsync(
72await context.Response.WriteAsync($"<h1>{SR["Request Localization Sample"]}</h1>");
73await context.Response.WriteAsync($"<h1>{SR["Hello"]}</h1>");
74await context.Response.WriteAsync("<form id=\"theForm\" method=\"get\">");
75await context.Response.WriteAsync($"<label for=\"culture\">{SR["Culture"]}: </label>");
76await context.Response.WriteAsync("<select id=\"culture\" name=\"culture\">");
78await context.Response.WriteAsync("</select><br />");
79await context.Response.WriteAsync($"<label for=\"uiCulture\">{SR["UI Culture"]}: </label>");
80await context.Response.WriteAsync("<select id=\"uiCulture\" name=\"ui-culture\">");
82await context.Response.WriteAsync("</select><br />");
83await context.Response.WriteAsync("<input type=\"submit\" value=\"go QS\" /> ");
84await context.Response.WriteAsync($"<input type=\"button\" value=\"go cookie\" onclick='useCookie();' /> ");
85await context.Response.WriteAsync($"<a href=\"/\" onclick='clearCookie();'>{SR["reset"]}</a>");
86await context.Response.WriteAsync("</form>");
87await context.Response.WriteAsync("<br />");
88await context.Response.WriteAsync("<table><tbody>");
89await context.Response.WriteAsync($"<tr><th>Winning provider:</th><td>{requestCultureFeature.Provider.GetType().Name}</td></tr>");
90await context.Response.WriteAsync($"<tr><th>{SR["Current request culture:"]}</th><td>{requestCulture.Culture.DisplayName} ({requestCulture.Culture})</td></tr>");
91await context.Response.WriteAsync($"<tr><th>{SR["Current request UI culture:"]}</th><td>{requestCulture.UICulture.DisplayName} ({requestCulture.UICulture})</td></tr>");
92await context.Response.WriteAsync($"<tr><th>{SR["Current thread culture:"]}</th><td>{CultureInfo.CurrentCulture.DisplayName} ({CultureInfo.CurrentCulture})</td></tr>");
93await context.Response.WriteAsync($"<tr><th>{SR["Current thread UI culture:"]}</th><td>{CultureInfo.CurrentUICulture.DisplayName} ({CultureInfo.CurrentUICulture})</td></tr>");
94await context.Response.WriteAsync($"<tr><th>{SR["Current date (invariant full):"]}</th><td>{DateTime.Now.ToString("F", CultureInfo.InvariantCulture)}</td></tr>");
95await context.Response.WriteAsync($"<tr><th>{SR["Current date (invariant):"]}</th><td>{DateTime.Now.ToString(CultureInfo.InvariantCulture)}</td></tr>");
96await context.Response.WriteAsync($"<tr><th>{SR["Current date (request full):"]}</th><td>{DateTime.Now.ToString("F", CultureInfo.CurrentCulture)}</td></tr>");
97await context.Response.WriteAsync($"<tr><th>{SR["Current date (request):"]}</th><td>{DateTime.Now.ToString(CultureInfo.CurrentCulture)}</td></tr>");
98await context.Response.WriteAsync($"<tr><th>{SR["Current time (invariant):"]}</th><td>{DateTime.Now.ToString("T", CultureInfo.InvariantCulture)}</td></tr>");
99await context.Response.WriteAsync($"<tr><th>{SR["Current time (request):"]}</th><td>{DateTime.Now.ToString("T", CultureInfo.CurrentCulture)}</td></tr>");
100await context.Response.WriteAsync($"<tr><th>{SR["Big number (invariant):"]}</th><td>{(Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.InvariantCulture)}</td></tr>");
101await context.Response.WriteAsync($"<tr><th>{SR["Big number (request):"]}</th><td>{(Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.CurrentCulture)}</td></tr>");
102await context.Response.WriteAsync($"<tr><th>{SR["Big number negative (invariant):"]}</th><td>{(-Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.InvariantCulture)}</td></tr>");
103await context.Response.WriteAsync($"<tr><th>{SR["Big number negative (request):"]}</th><td>{(-Math.Pow(2, 42) + 0.42).ToString("N", CultureInfo.CurrentCulture)}</td></tr>");
104await context.Response.WriteAsync($"<tr><th>{SR["Money (invariant):"]}</th><td>{2199.50.ToString("C", CultureInfo.InvariantCulture)}</td></tr>");
105await context.Response.WriteAsync($"<tr><th>{SR["Money (request):"]}</th><td>{2199.50.ToString("C", CultureInfo.CurrentCulture)}</td></tr>");
106await context.Response.WriteAsync($"<tr><th>{SR["Money negative (invariant):"]}</th><td>{(-2199.50).ToString("C", CultureInfo.InvariantCulture)}</td></tr>");
107await context.Response.WriteAsync($"<tr><th>{SR["Money negative (request):"]}</th><td>{(-2199.50).ToString("C", CultureInfo.CurrentCulture)}</td></tr>");
108await context.Response.WriteAsync("</tbody></table>");
109await context.Response.WriteAsync(
117await context.Response.WriteAsync($" <option value=\"\">-- select --</option>");
118await context.Response.WriteAsync($" <option value=\"{new CultureInfo("en-US").Name}\">{new CultureInfo("en-US").DisplayName}</option>");
119await context.Response.WriteAsync($" <option value=\"{new CultureInfo("en-AU").Name}\">{new CultureInfo("en-AU").DisplayName}</option>");
120await context.Response.WriteAsync($" <option value=\"{new CultureInfo("en-GB").Name}\">{new CultureInfo("en-GB").DisplayName}</option>");
121await context.Response.WriteAsync($" <option value=\"{new CultureInfo("fr-FR").Name}\">{new CultureInfo("fr-FR").DisplayName}</option>");
122await context.Response.WriteAsync($" <option value=\"{new CultureInfo("es-ES").Name}\">{new CultureInfo("es-ES").DisplayName}</option>");
123await context.Response.WriteAsync($" <option value=\"{new CultureInfo("ja-JP").Name}\">{new CultureInfo("ja-JP").DisplayName}</option>");
124await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh").Name}\">{new CultureInfo("zh").DisplayName}</option>");
125await context.Response.WriteAsync($" <option value=\"{new CultureInfo("zh-CN").Name}\">{new CultureInfo("zh-CN").DisplayName}</option>");
126await context.Response.WriteAsync($" <option value=\"en-NOTREAL\">English (Not a real locale)</option>");
127await context.Response.WriteAsync($" <option value=\"pp-NOTREAL\">Made-up (Not a real anything)</option>");
LocalizationWebsite (29)
Logging.W3C.Sample (2)
Microsoft.AspNetCore.Antiforgery (8)
Microsoft.AspNetCore.Antiforgery.Test (27)
DefaultAntiforgeryTest.cs (23)
311Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
312Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
326context.HttpContext.Response.Headers.CacheControl = "public";
342Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
343Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
363context.HttpContext.Response.Headers[headerName] = headerValue;
367return context.HttpContext.Response.Headers[headerName].ToString();
504Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers.CacheControl);
505Assert.Equal("no-cache", context.HttpContext.Response.Headers.Pragma);
997context.HttpContext.Response.Headers["X-Frame-Options"] = expectedHeaderValue;
1003var xFrameOptions = context.HttpContext.Response.Headers["X-Frame-Options"];
1026Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1027Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1049Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1050Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1067context.HttpContext.Response.Headers["Cache-Control"] = "public";
1073Assert.Equal("no-cache, no-store", context.HttpContext.Response.Headers["Cache-Control"]);
1074Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
1103var xFrameOptions = context.HttpContext.Response.Headers["X-Frame-Options"];
1266context.HttpContext.Response.Headers["Cache-Control"] = "public";
1272Assert.Equal("public", context.HttpContext.Response.Headers["Cache-Control"]);
1332context.HttpContext.Response.Headers[headerName] = headerValue;
1366context.HttpContext.Response.Headers[headerName] = headerValue;
Microsoft.AspNetCore.Authentication (2)
Microsoft.AspNetCore.Authentication.Cookies (5)
Microsoft.AspNetCore.Authentication.Negotiate (1)
Microsoft.AspNetCore.Authentication.Negotiate.Test (60)
EventTests.cs (26)
41Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
42Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
65Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
66Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
113Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
114Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
163Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
164Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
188Assert.Equal(StatusCodes.Status418ImATeapot, response.Response.StatusCode);
213Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
214Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
238Assert.Equal(StatusCodes.Status400BadRequest, response.Response.StatusCode);
263Assert.Equal(StatusCodes.Status418ImATeapot, result.Response.StatusCode);
264Assert.Equal("Teapot", result.Response.Headers.WWWAuthenticate);
293Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
294Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
339Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
340Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
363Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
364Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
398Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
399Assert.Equal("Negotiate ServerKerberosBlob1", result.Response.Headers.WWWAuthenticate);
405Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
406Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers.WWWAuthenticate);
447await context.Response.WriteAsync(name);
452context.Response.StatusCode = StatusCodes.Status418ImATeapot;
NegotiateHandlerTests.cs (34)
40Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
50Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
60Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
61Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
72Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
73Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
82Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
83Assert.Equal("Negotiate ServerNtlmBlob1", result.Response.Headers.WWWAuthenticate);
164Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
165Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
191Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
192Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
275return context.Response.WriteAsync("Error Handler");
289Assert.Equal(StatusCodes.Status500InternalServerError, result.Response.StatusCode);
290Assert.False(result.Response.Headers.ContainsKey(HeaderNames.WWWAuthenticate));
300Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
301Assert.Equal("Negotiate", result.Response.Headers.WWWAuthenticate);
311Assert.Equal(StatusCodes.Status400BadRequest, result.Response.StatusCode);
312Assert.DoesNotContain(HeaderNames.WWWAuthenticate, result.Response.Headers);
328Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
329Assert.Equal("Negotiate ServerKerberosBlob", result.Response.Headers.WWWAuthenticate);
336Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
337Assert.Equal("Negotiate ServerKerberosBlob", result.Response.Headers.WWWAuthenticate);
349Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
350Assert.Equal("Negotiate ServerKerberosBlob1", result.Response.Headers.WWWAuthenticate);
356Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
357Assert.Equal("Negotiate ServerKerberosBlob2", result.Response.Headers.WWWAuthenticate);
369Assert.Equal(StatusCodes.Status401Unauthorized, result.Response.StatusCode);
370Assert.Equal("Negotiate ServerNtlmBlob1", result.Response.Headers.WWWAuthenticate);
376Assert.Equal(StatusCodes.Status200OK, result.Response.StatusCode);
377Assert.Equal("Negotiate ServerNtlmBlob2", result.Response.Headers.WWWAuthenticate);
432await context.Response.WriteAsync(name);
450await context.Response.WriteAsync(name);
459await context.Response.WriteAsync(name);
Microsoft.AspNetCore.Authentication.OAuth (2)
Microsoft.AspNetCore.Authentication.OpenIdConnect (2)
Microsoft.AspNetCore.Authentication.Test (55)
Microsoft.AspNetCore.Authorization.Test (1)
Microsoft.AspNetCore.Components.Endpoints (38)
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
Microsoft.AspNetCore.Components.Server (6)
Microsoft.AspNetCore.Components.WebAssembly.Server (26)
Microsoft.AspNetCore.ConcurrencyLimiter (1)
Microsoft.AspNetCore.CookiePolicy (2)
Microsoft.AspNetCore.CookiePolicy.Test (94)
CookieConsentTests.cs (51)
27context.Response.Cookies.Append("Test", "Value");
30Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
46context.Response.Cookies.Append("Test", "Value");
49Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
65context.Response.Cookies.Append("Test", "Value", new CookieOptions() { IsEssential = false });
68Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
91context.Response.Cookies.Append("Test", "Value", new CookieOptions() { IsEssential = false });
94Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
110context.Response.Cookies.Append("Test", "Value", new CookieOptions() { IsEssential = true });
113Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
140context.Response.Cookies.Append("Test", "Value", new CookieOptions() { IsEssential = true });
143Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
163context.Response.Cookies.Append("Test", "Value");
166Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
186context.Response.Cookies.Append("Test", "Value");
189Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
213context.Response.Cookies.Append("Test", "Value");
217var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
267var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
301context.Response.Cookies.Append("Test", "Value");
305Assert.Equal("Test=Value; path=/", httpContext.Response.Headers.SetCookie);
323await context.Response.WriteAsync("Started.");
331Assert.Throws<InvalidOperationException>(() => context.Response.Cookies.Append("Test", "Value"));
333await context.Response.WriteAsync("Granted.");
336var reader = new StreamReader(httpContext.Response.Body);
338Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
362context.Response.Cookies.Append("Test", "Value");
366Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
386context.Response.Cookies.Append("Test", "Value1");
394context.Response.Cookies.Append("Test", "Value2");
398var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
445var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
471context.Response.Cookies.Append("Test", "Value1");
473await context.Response.WriteAsync("Started.");
482context.Response.Cookies.Append("Test", "Value2");
484await context.Response.WriteAsync("Withdrawn.");
487var reader = new StreamReader(httpContext.Response.Body);
489Assert.Equal("Test=Value1; path=/", httpContext.Response.Headers.SetCookie);
506context.Response.Cookies.Delete("Test");
510var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
540context.Response.Cookies.Delete("Test");
544Assert.Equal(0, httpContext.Response.Headers.SetCookie.Count);
569context.Response.Headers["ManualCookie"] = cookie;
574var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
582cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
622context.Response.Headers["ManualCookie"] = cookie;
627var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
635cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
667context.Response.Headers["ManualCookie"] = cookie;
672var cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers.SetCookie);
680cookies = SetCookieHeaderValue.ParseList(httpContext.Response.Headers["ManualCookie"]);
CookiePolicyTests.cs (27)
23context.Response.Cookies.Append("A", "A");
24context.Response.Cookies.Append("B", "B", new CookieOptions { Secure = false });
25context.Response.Cookies.Append("C", "C", new CookieOptions());
26context.Response.Cookies.Append("D", "D", new CookieOptions { Secure = true });
31context.Response.Cookies.Append("A", "A");
32context.Response.Cookies.Append("B", "B", new CookieOptions { HttpOnly = false });
33context.Response.Cookies.Append("C", "C", new CookieOptions());
34context.Response.Cookies.Append("D", "D", new CookieOptions { HttpOnly = true });
39context.Response.Cookies.Append("A", "A");
40context.Response.Cookies.Append("B", "B", new CookieOptions());
41context.Response.Cookies.Append("C", "C", new CookieOptions { SameSite = Http.SameSiteMode.None });
42context.Response.Cookies.Append("D", "D", new CookieOptions { SameSite = Http.SameSiteMode.Lax });
43context.Response.Cookies.Append("E", "E", new CookieOptions { SameSite = Http.SameSiteMode.Strict });
44context.Response.Cookies.Append("F", "F", new CookieOptions { SameSite = (Http.SameSiteMode)(-1) });
257context.Response.Cookies.Append("A", "A");
258context.Response.Cookies.Append("B", "B", new CookieOptions { Secure = false });
259context.Response.Cookies.Append("C", "C", new CookieOptions() { SameSite = Http.SameSiteMode.Strict });
260context.Response.Cookies.Append("D", "D", new CookieOptions { Secure = true });
296context.Response.Cookies.Delete("A");
297context.Response.Cookies.Delete("B", new CookieOptions { Secure = false });
298context.Response.Cookies.Delete("C", new CookieOptions());
299context.Response.Cookies.Delete("D", new CookieOptions { Secure = true });
338Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A"));
339Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Delete("A", new CookieOptions()));
340Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A"));
341Assert.Throws<NotImplementedException>(() => context.Response.Cookies.Append("A", "A", new CookieOptions()));
342return context.Response.WriteAsync("Done");
Microsoft.AspNetCore.Cors (5)
Microsoft.AspNetCore.Cors.Test (13)
Microsoft.AspNetCore.Diagnostics (37)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (8)
Microsoft.AspNetCore.Diagnostics.HealthChecks (7)
Microsoft.AspNetCore.Diagnostics.HealthChecks.Tests (4)
Microsoft.AspNetCore.Diagnostics.Middleware (10)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (17)
Microsoft.AspNetCore.Diagnostics.Tests (71)
ExceptionHandlerTest.cs (56)
43await httpContext.Response.WriteAsync("Handled error in a custom way.");
49context.Response.StatusCode = (int)expectedStatusCode;
50context.Response.ContentType = "text/plain; charset=utf-8";
51await context.Response.WriteAsync("An error occurred while adding a product");
99await httpContext.Response.WriteAsync("Handled error in a custom way.");
105await httpContext.Response.WriteAsync("Hello");
136var response = httpContext.Response;
160Assert.True(httpContext.Response.Body.CanSeek);
161Assert.Equal(0, httpContext.Response.Body.Position);
163await httpContext.Response.WriteAsync(expectedResponseBody);
170await context.Response.WriteAsync(new string('a', 100));
216httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=600" });
217httpContext.Response.Headers.Add("Pragma", new[] { "max-age=600" });
218httpContext.Response.Headers.Add(
220httpContext.Response.Headers.Add("ETag", new[] { "12345" });
222await httpContext.Response.WriteAsync(expectedResponseBody);
272await httpContext.Response.WriteAsync("Handled error in a custom way.");
278httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
279httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
280httpContext.Response.Headers.Add("Expires", new[] { expiresTime });
281httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
283await httpContext.Response.WriteAsync(expectedResponseBody);
343httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
344await httpContext.Response.WriteAsync("Custom 404");
350httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
351httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
352httpContext.Response.Headers.Add("Expires", new[] { DateTime.UtcNow.AddDays(10).ToString("R") });
353httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
412await httpContext.Response.WriteAsync("Handled error in a custom way.");
418httpContext.Response.Headers.Add("Cache-Control", new[] { "max-age=3600" });
419httpContext.Response.Headers.Add("Pragma", new[] { "max-age=3600" });
420httpContext.Response.Headers.Add("Expires", new[] { expiresTime });
421httpContext.Response.Headers.Add("ETag", new[] { "abcdef" });
423await httpContext.Response.WriteAsync("Hello");
474await httpContext.Response.WriteAsync("Handled error in a custom way.");
558httpContext.Response.StatusCode = StatusCodes.Status500InternalServerError;
580await httpContext.Response.WriteAsync("Handled error in a custom way.");
624httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
749c.Response.StatusCode = 200;
750return c.Response.WriteAsync("separate pipeline");
805c.Response.StatusCode = 200;
806return c.Response.WriteAsync("Handled");
859c.Response.StatusCode = 200;
860return c.Response.WriteAsync("Handled");
911c.Response.StatusCode = 200;
912return c.Response.WriteAsync("Handled");
960httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
961return httpContext.Response.WriteAsync("Custom handler");
969c.Response.StatusCode = 200;
970return c.Response.WriteAsync("Handled");
1012httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
1013return httpContext.Response.WriteAsync("Custom handler");
1067httpContext.Response.StatusCode = StatusCodes.Status500InternalServerError;
1082httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
1145httpContext.Response.StatusCode = StatusCodes.Status404NotFound;
1146return httpContext.Response.WriteAsync("Custom handler");
Microsoft.AspNetCore.FunctionalTests (1)
Microsoft.AspNetCore.Grpc.JsonTranscoding (13)
Microsoft.AspNetCore.HostFiltering (4)
Microsoft.AspNetCore.Hosting (15)
Microsoft.AspNetCore.Hosting.Tests (3)
Microsoft.AspNetCore.Hosting.TestSites (1)
Microsoft.AspNetCore.Http (12)
Microsoft.AspNetCore.Http.Abstractions.Tests (29)
Microsoft.AspNetCore.Http.Connections (75)
Microsoft.AspNetCore.Http.Connections.Tests (6)
Microsoft.AspNetCore.Http.Extensions (30)
RequestDelegateFactory.cs (25)
93private static readonly MemberExpression HttpResponseExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!);
117private static readonly MemberExpression FilterContextHttpContextResponseExpr = Expression.Property(FilterContextHttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!);
1390httpContext.Response.StatusCode = StatusCodes.Status415UnsupportedMediaType;
1400httpContext.Response.StatusCode = ex.StatusCode;
1406httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1412httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1507httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1514httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1521httpContext.Response.StatusCode = StatusCodes.Status415UnsupportedMediaType;
1532httpContext.Response.StatusCode = ex.StatusCode;
1538httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
1544httpContext.Response.StatusCode = StatusCodes.Status400BadRequest;
2430await WriteJsonResponseFast(httpContext.Response, await task, jsonTypeInfo);
2435return WriteJsonResponseFast(httpContext.Response, task.GetAwaiter().GetResult(), jsonTypeInfo);
2447await WriteJsonResponse(httpContext.Response, await task, jsonTypeInfo);
2452return WriteJsonResponse(httpContext.Response, task.GetAwaiter().GetResult(), jsonTypeInfo);
2465await httpContext.Response.WriteAsync(await task);
2470return httpContext.Response.WriteAsync(task.GetAwaiter().GetResult()!);
2479return httpContext.Response.WriteAsync(text);
2535await WriteJsonResponseFast(httpContext.Response, await task, jsonTypeInfo);
2540return WriteJsonResponseFast(httpContext.Response, task.GetAwaiter().GetResult(), jsonTypeInfo);
2550await WriteJsonResponse(httpContext.Response, await task, jsonTypeInfo);
2555return WriteJsonResponse(httpContext.Response, task.GetAwaiter().GetResult(), jsonTypeInfo);
2567await httpContext.Response.WriteAsync(await task);
2572return httpContext.Response.WriteAsync(task.GetAwaiter().GetResult()!);
Microsoft.AspNetCore.Http.Extensions.Tests (76)
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (24)
42Assert.Equal(400, httpContext.Response.StatusCode);
43Assert.False(httpContext.Response.HasStarted);
105Assert.Equal(400, httpContext.Response.StatusCode);
106Assert.False(httpContext.Response.HasStarted);
158Assert.Equal(200, httpContext.Response.StatusCode);
159Assert.False(httpContext.Response.HasStarted);
195Assert.Equal(200, httpContext.Response.StatusCode);
196Assert.False(httpContext.Response.HasStarted);
226Assert.Equal(400, httpContext.Response.StatusCode);
275Assert.Equal(200, httpContext.Response.StatusCode);
276Assert.False(httpContext.Response.HasStarted);
306Assert.Equal(400, httpContext.Response.StatusCode);
354Assert.Equal(200, httpContext.Response.StatusCode);
355Assert.False(httpContext.Response.HasStarted);
400Assert.Equal(415, httpContext.Response.StatusCode);
449Assert.Equal(415, httpContext.Response.StatusCode);
526Assert.Equal(400, httpContext.Response.StatusCode);
527Assert.False(httpContext.Response.HasStarted);
568Assert.Equal(200, httpContext.Response.StatusCode);
569Assert.False(httpContext.Response.HasStarted);
606Assert.Equal(400, httpContext.Response.StatusCode);
607Assert.False(httpContext.Response.HasStarted);
647Assert.Equal(200, httpContext.Response.StatusCode);
648Assert.False(httpContext.Response.HasStarted);
Microsoft.AspNetCore.Http.Microbenchmarks (7)
Microsoft.AspNetCore.Http.Results (58)
Microsoft.AspNetCore.Http.Results.Tests (127)
Microsoft.AspNetCore.Http.Tests (3)
Microsoft.AspNetCore.HttpLogging (4)
Microsoft.AspNetCore.HttpLogging.Tests (65)
Microsoft.AspNetCore.HttpsPolicy (3)
Microsoft.AspNetCore.HttpsPolicy.Tests (18)
Microsoft.AspNetCore.Identity.InMemory.Test (1)
Microsoft.AspNetCore.Localization (1)
Microsoft.AspNetCore.Localization.Routing.Tests (3)
Microsoft.AspNetCore.Mvc.Core (53)
Microsoft.AspNetCore.Mvc.Core.Test (195)
Filters\ResponseCacheFilterExecutorTest.cs (12)
29Assert.Equal("no-store", context.HttpContext.Response.Headers["Cache-control"]);
188Assert.Equal(output, context.HttpContext.Response.Headers["Cache-control"]);
245Assert.Equal(output, context.HttpContext.Response.Headers["Cache-control"]);
325Assert.Equal(varyOutput, context.HttpContext.Response.Headers["Vary"]);
326Assert.Equal(cacheControlOutput, context.HttpContext.Response.Headers["Cache-control"]);
409Assert.Equal(cacheControlOutput, context.HttpContext.Response.Headers.CacheControl);
450Assert.Equal("no-store,no-cache", context.HttpContext.Response.Headers["Cache-control"]);
451Assert.Equal("no-cache", context.HttpContext.Response.Headers["Pragma"]);
470Assert.Equal("public,max-age=20", context.HttpContext.Response.Headers["Cache-control"]);
490Assert.Equal("private,max-age=10", context.HttpContext.Response.Headers["Cache-control"]);
510Assert.Equal("public,max-age=10", context.HttpContext.Response.Headers["Cache-control"]);
530Assert.Equal("Test", context.HttpContext.Response.Headers["Vary"]);
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.Cors.Test (6)
Microsoft.AspNetCore.Mvc.Formatters.Xml (4)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (30)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (3)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (28)
Microsoft.AspNetCore.Mvc.Razor (1)
Microsoft.AspNetCore.Mvc.RazorPages (2)
Microsoft.AspNetCore.Mvc.RazorPages.Test (2)
Microsoft.AspNetCore.Mvc.ViewFeatures (7)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (23)
Microsoft.AspNetCore.OpenApi (7)
Microsoft.AspNetCore.OutputCaching.Tests (70)
OutputCacheMiddlewareTests.cs (34)
46Assert.Equal(StatusCodes.Status504GatewayTimeout, context.HttpContext.Response.StatusCode);
106context.HttpContext.Response.Headers["MyHeader"] = "OldValue";
119Assert.Equal("NewValue", context.HttpContext.Response.Headers["MyHeader"]);
433context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
456context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
461context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
482context.HttpContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
487context.HttpContext.Response.Headers.Expires = HeaderUtilities.FormatDate(timeProvider.GetUtcNow() + TimeSpan.FromSeconds(11));
522context.HttpContext.Response.Headers.Vary = vary;
543Assert.True(StringValues.IsNullOrEmpty(context.HttpContext.Response.Headers.Date));
547Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date);
562context.HttpContext.Response.Headers.Date = HeaderUtilities.FormatDate(utcNow);
565Assert.Equal(HeaderUtilities.FormatDate(utcNow), context.HttpContext.Response.Headers.Date);
569Assert.Equal(HeaderUtilities.FormatDate(responseTime), context.HttpContext.Response.Headers.Date);
595context.HttpContext.Response.Headers.Vary = "HeaderB, heaDera";
611context.HttpContext.Response.ContentLength = 20;
613await context.HttpContext.Response.WriteAsync(new string('0', 20));
639context.HttpContext.Response.ContentLength = 9;
642await context.HttpContext.Response.WriteAsync(new string('0', 10));
668context.HttpContext.Response.ContentLength = 10;
674await context.HttpContext.Response.WriteAsync(new string('0', 10));
700await context.HttpContext.Response.WriteAsync(new string('0', 10));
724await context.HttpContext.Response.WriteAsync(new string('0', 10));
745await context.HttpContext.Response.WriteAsync(new string('0', 10));
772await context.HttpContext.Response.WriteAsync(new string('0', 101));
876c.Response.Cookies.Append("a", "b");
877c.Response.Write("Hello" + responseCounter);
885context1.HttpContext.Response.Body = memoryStream1;
890context2.HttpContext.Response.Body = memoryStream2;
943c.Response.Write("Hello" + responseCounter);
972context.HttpContext.Response.ContentLength = 5;
976await context.HttpContext.Response.WriteAsync("Hello");
1025await c.Response.WriteAsync(Guid.NewGuid().ToString());
1046requestContext.HttpContext.Response.Body = responseStream;
Microsoft.AspNetCore.Owin (1)
Microsoft.AspNetCore.Owin.Tests (6)
Microsoft.AspNetCore.RateLimiting (1)
Microsoft.AspNetCore.RateLimiting.Tests (14)
Microsoft.AspNetCore.ResponseCaching (16)
Microsoft.AspNetCore.ResponseCaching.Microbenchmarks (2)
Microsoft.AspNetCore.ResponseCaching.Tests (19)
Microsoft.AspNetCore.ResponseCompression (4)
Microsoft.AspNetCore.ResponseCompression.Tests (62)
ResponseCompressionMiddlewareTest.cs (62)
165context.Response.Headers.ContentMD5 = "MD5";
166context.Response.ContentType = TextPlain;
167return context.Response.WriteAsync(new string('a', 100));
323context.Response.Headers.ContentMD5 = "MD5";
324context.Response.ContentType = contentType;
461context.Response.ContentType = TextPlain;
462return context.Response.WriteAsync(new string('a', 100));
524context.Response.ContentType = TextPlain;
525return context.Response.WriteAsync(new string('a', 100));
587context.Response.ContentType = TextPlain;
588return context.Response.WriteAsync(new string('a', 100));
638context.Response.Headers.ContentMD5 = "MD5";
639context.Response.ContentType = TextPlain;
640context.Response.Body.Flush();
642await context.Response.WriteAsync(new string('a', 100));
684context.Response.Headers.ContentMD5 = "MD5";
685context.Response.ContentType = TextPlain;
686await context.Response.Body.FlushAsync();
688await context.Response.WriteAsync(new string('a', 100));
735context.Response.Headers.ContentMD5 = "MD5";
736context.Response.ContentType = TextPlain;
737context.Response.Body.Write(new byte[10], 0, 10);
738context.Response.Body.Flush();
740context.Response.Body.Write(new byte[90], 0, 90);
788context.Response.Headers.ContentMD5 = "MD5";
789context.Response.ContentType = TextPlain;
790await context.Response.WriteAsync(new string('a', 10));
791await context.Response.Body.FlushAsync();
793await context.Response.WriteAsync(new string('a', 90));
848context.Response.Headers.ContentMD5 = "MD5";
849context.Response.ContentType = TextPlain;
860context.Response.Body.Write(new byte[1], 0, 1);
861context.Response.Body.Flush();
918context.Response.Headers.ContentMD5 = "MD5";
919context.Response.ContentType = TextPlain;
924await context.Response.WriteAsync("a");
925await context.Response.Body.FlushAsync();
982context.Response.Headers.ContentMD5 = "MD5";
983context.Response.ContentType = "Un/compressed";
988await context.Response.WriteAsync("a");
989await context.Response.Body.FlushAsync();
1047context.Response.Headers.ContentMD5 = "MD5";
1048context.Response.ContentType = "custom/type";
1049context.Response.ContentLength = 1024;
1097context.Response.Headers.ContentMD5 = "MD5";
1098context.Response.ContentType = TextPlain;
1099context.Response.ContentLength = 1024;
1147context.Response.Headers.ContentMD5 = "MD5";
1148context.Response.ContentType = TextPlain;
1151await context.Response.WriteAsync(new string('a', 100));
1191context.Response.Body = new NoSyncWrapperStream(context.Response.Body);
1197context.Response.Headers.ContentMD5 = "MD5";
1198context.Response.ContentType = TextPlain;
1199await context.Response.WriteAsync(new string('a', 10));
1200await context.Response.Body.FlushAsync();
1202await context.Response.WriteAsync(new string('a', 90));
1258context.Response.Headers.ContentMD5 = "MD5";
1259context.Response.ContentType = responseType;
1263context.Response.ContentLength = uncompressedBodyLength;
1267addResponseAction?.Invoke(context.Response);
1268return context.Response.WriteAsync(new string('a', uncompressedBodyLength));
Microsoft.AspNetCore.Rewrite (10)
Microsoft.AspNetCore.Rewrite.Tests (56)
MiddlewareTests.cs (20)
28app.Run(context => context.Response.WriteAsync(
58app.Run(context => context.Response.WriteAsync(
90app.Run(context => context.Response.WriteAsync(
122app.Run(context => context.Response.WriteAsync(
659endpoints.MapGet("/foos", context => context.Response.WriteAsync("bad"));
660endpoints.MapGet("/foo", context => context.Response.WriteAsync($"{context.GetEndpoint()?.DisplayName} from {context.Request.Path}"));
686app.Run(context => context.Response.WriteAsync(
713app.Run(context => context.Response.WriteAsync(
857endpoints.MapGet("/foo", context => context.Response.WriteAsync(
860endpoints.MapGet("/g", context => context.Response.WriteAsync(
895endpoints.MapGet("/foo", context => context.Response.WriteAsync(
898endpoints.MapGet("/g", context => context.Response.WriteAsync(
931endpoints.MapGet("/foo", context => context.Response.WriteAsync(
934endpoints.MapGet("/g", context => context.Response.WriteAsync(
968endpoints.MapGet("/foo", context => context.Response.WriteAsync(
971endpoints.MapGet("/g/h", context => context.Response.WriteAsync(
1005endpoints.MapGet("/foo", context => context.Response.WriteAsync(
1008endpoints.MapGet("/g", context => context.Response.WriteAsync(
1038app.MapGet("/foo", context => context.Response.WriteAsync(
1041app.MapGet("/g", context => context.Response.WriteAsync(
Microsoft.AspNetCore.Routing (10)
Microsoft.AspNetCore.Routing.FunctionalTests (7)
Microsoft.AspNetCore.Routing.Tests (8)
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (6)
203Assert.Equal(405, httpContext.Response.StatusCode);
204Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]);
313Assert.Equal(405, httpContext.Response.StatusCode);
314Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]);
318Assert.Equal(405, httpContext.Response.StatusCode);
319Assert.Equal("DELETE, GET, PUT", httpContext.Response.Headers["Allow"]);
Microsoft.AspNetCore.Security.Microbenchmarks (2)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (341)
RequestBodyLimitTests.cs (18)
32httpContext.Response.ContentLength = read;
33httpContext.Response.Body.Write(input, 0, read);
55httpContext.Response.ContentLength = read;
56await httpContext.Response.Body.WriteAsync(input, 0, read);
76httpContext.Response.ContentLength = read;
77httpContext.Response.Body.EndWrite(httpContext.Response.Body.BeginWrite(input, 0, read, null, null));
99httpContext.Response.ContentLength = read;
100httpContext.Response.Body.Write(input, 0, read);
122httpContext.Response.ContentLength = read;
123await httpContext.Response.Body.WriteAsync(input, 0, read);
143httpContext.Response.ContentLength = read;
144httpContext.Response.Body.EndWrite(httpContext.Response.Body.BeginWrite(input, 0, read, null, null));
372httpContext.Response.ContentLength = read;
373await httpContext.Response.Body.WriteAsync(input, 0, read);
396httpContext.Response.ContentLength = read;
397await httpContext.Response.Body.WriteAsync(input, 0, read);
RequestBodyTests.cs (16)
33httpContext.Response.ContentLength = read;
34httpContext.Response.Body.Write(input, 0, read);
55httpContext.Response.ContentLength = read;
56httpContext.Response.Body.Write(input, 0, read);
74httpContext.Response.ContentLength = read;
75await httpContext.Response.Body.WriteAsync(input, 0, read);
94httpContext.Response.ContentLength = read;
95await httpContext.Response.Body.WriteAsync(input, 0, read);
111httpContext.Response.ContentLength = read;
112httpContext.Response.Body.EndWrite(httpContext.Response.Body.BeginWrite(input, 0, read, null, null));
196httpContext.Response.ContentLength = 10;
197await httpContext.Response.Body.WriteAsync(input, 0, 10);
230httpContext.Response.ContentLength = read;
231await httpContext.Response.Body.WriteAsync(input, 0, read);
284httpContext.Response.StatusCode = 200;
RequestTests.cs (5)
59httpContext.Response.Body.Write(body, 0, body.Length);
123httpContext.Response.Body.Write(body, 0, body.Length);
186httpContext.Response.Body.Write(body, 0, body.Length);
230httpContext.Response.Body.Write(body, 0, body.Length);
327httpContext.Response.Body.Write(body, 0, body.Length);
ResponseBodyTests.cs (41)
20httpContext.Response.OnStarting(() =>
25await httpContext.Response.StartAsync();
26Assert.True(httpContext.Response.HasStarted);
27Assert.True(httpContext.Response.Headers.IsReadOnly);
29await httpContext.Response.WriteAsync("Hello World");
49httpContext.Response.OnStarting(() =>
54await httpContext.Response.CompleteAsync();
55Assert.True(httpContext.Response.HasStarted);
56Assert.True(httpContext.Response.Headers.IsReadOnly);
75var writer = httpContext.Response.BodyWriter;
78await httpContext.Response.CompleteAsync();
95var writer = httpContext.Response.BodyWriter;
115httpContext.Response.Body.Write(new byte[10], 0, 10);
116return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
146httpContext.Response.Body.Write(new byte[WriteSize], 0, WriteSize);
148await httpContext.Response.Body.WriteAsync(new byte[WriteSize], 0, WriteSize);
171httpContext.Response.Body.Write(new byte[10], 0, 10);
172await httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
173await httpContext.Response.Body.FlushAsync();
192httpContext.Response.Headers["transfeR-Encoding"] = "CHunked";
193Stream stream = httpContext.Response.Body;
215httpContext.Response.Headers["Content-lenGth"] = " 30 ";
216Stream stream = httpContext.Response.Body;
239httpContext.Response.Headers["Content-lenGth"] = " 20 ";
253httpContext.Response.Headers["Content-lenGth"] = " 20 ";
254return httpContext.Response.Body.WriteAsync(new byte[5], 0, 5);
268httpContext.Response.Headers["Content-lenGth"] = " 10 ";
269await httpContext.Response.Body.WriteAsync(new byte[5], 0, 5);
271httpContext.Response.Body.WriteAsync(new byte[6], 0, 6));
289httpContext.Response.Headers["Content-lenGth"] = " 10 ";
290httpContext.Response.Body.Write(new byte[10], 0, 10);
291httpContext.Response.Body.Write(new byte[9], 0, 9);
323httpContext.Response.OnStarting(state =>
329httpContext.Response.Body.Write(new byte[10], 0, 10);
351httpContext.Response.OnStarting(state =>
357httpContext.Response.Body.EndWrite(httpContext.Response.Body.BeginWrite(new byte[10], 0, 10, null, null));
379httpContext.Response.OnStarting(state =>
385return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
411httpContext.Response.ContentLength = data.Length;
413var body = httpContext.Response.Body;
ResponseCachingTests.cs (99)
51httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
52httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
53httpContext.Response.ContentLength = 10;
54return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
70httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
71httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
72httpContext.Response.Headers["Cache-Control"] = "public";
73httpContext.Response.ContentLength = 10;
74return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
92httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
93httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
94httpContext.Response.ContentLength = 10;
95return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
111httpContext.Response.StatusCode = StatusCodes.Status304NotModified;
112httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
113httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
114httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
115httpContext.Response.ContentLength = 10;
116return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
138httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
139httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
140httpContext.Response.ContentLength = 10;
141return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
157httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
158httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
159httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
160httpContext.Response.ContentLength = 10;
161return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
177httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
178httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
179httpContext.Response.Headers["Cache-Control"] = "public, max-age=" + int.MaxValue.ToString(CultureInfo.InvariantCulture);
180httpContext.Response.ContentLength = 10;
181return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
197httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
198httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
199httpContext.Response.Headers["Cache-Control"] = "public, s-maxage=10";
200httpContext.Response.ContentLength = 10;
201return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
217httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
218httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
219httpContext.Response.Headers["Cache-Control"] = "public, max-age=0, s-maxage=10";
220httpContext.Response.ContentLength = 10;
221return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
237httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
238httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
239httpContext.Response.Headers["Cache-Control"] = "public";
240httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r");
241httpContext.Response.ContentLength = 10;
242return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
261httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
262httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
263httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
264httpContext.Response.Headers[headerName] = "headerValue";
265httpContext.Response.ContentLength = 10;
266return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
284httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
285httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
286httpContext.Response.Headers["Cache-Control"] = "public";
287httpContext.Response.Headers["Expires"] = expiresValue;
288httpContext.Response.ContentLength = 10;
289return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
305httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
306httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
307httpContext.Response.Headers["Expires"] = (DateTime.UtcNow + TimeSpan.FromSeconds(10)).ToString("r");
308httpContext.Response.ContentLength = 10;
309return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
325httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
326httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
327httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
328httpContext.Response.Headers["Expires"] = (DateTime.UtcNow - TimeSpan.FromSeconds(10)).ToString("r"); // In the past
329httpContext.Response.ContentLength = 10;
330return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
346httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
347httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
348httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
349httpContext.Response.ContentLength = 10;
350httpContext.Response.Body.FlushAsync();
351return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
367httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
368httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
369httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
370httpContext.Response.ContentLength = 10;
371await httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
373Assert.Null(httpContext.Response.ContentLength);
389httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
390httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
391httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
392await httpContext.Response.SendFileAsync(_absoluteFilePath, 0, null, CancellationToken.None);
408httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
409httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
410httpContext.Response.Headers["Cache-Control"] = "public, max-age=30";
411httpContext.Response.ContentLength = _fileLength;
412await httpContext.Response.SendFileAsync(_absoluteFilePath, 0, null, CancellationToken.None);
428httpContext.Response.ContentType = "some/thing"; // Http.Sys requires content-type for caching
429httpContext.Response.Headers["x-request-count"] = (requestCount++).ToString(CultureInfo.InvariantCulture);
430httpContext.Response.Headers["Cache-Control"] = "public, max-age=10";
432httpContext.Response.StatusCode = status;
433httpContext.Response.ContentLength = 10;
434return httpContext.Response.Body.WriteAsync(new byte[10], 0, 10);
ResponseSendFileTests.cs (24)
221httpContext.Response.Headers["Content-lenGth"] = FileLength.ToString(CultureInfo.InvariantCulture);
242httpContext.Response.Headers["Content-lenGth"] = "10";
263httpContext.Response.Headers["Content-lenGth"] = "0";
284httpContext.Response.OnStarting(state =>
315await httpContext.Response.SendFileAsync(emptyFilePath, 0, null, CancellationToken.None);
316Assert.True(httpContext.Response.HasStarted);
317await httpContext.Response.Body.WriteAsync(new byte[10], 0, 10, CancellationToken.None);
340await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
341await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
358await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
359await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
379var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
407var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
434await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
436var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
461await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
463var writeTask = httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
502await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
507httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token));
549await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null);
589await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
600await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
641await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null);
650await httpContext.Response.SendFileAsync(AbsoluteFilePath, 0, null, CancellationToken.None);
ResponseTrailersTests.cs (30)
28Assert.False(httpContext.Response.SupportsTrailers());
46Assert.True(httpContext.Response.SupportsTrailers());
63Assert.True(httpContext.Response.SupportsTrailers());
66Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer(header, "value"));
84httpContext.Response.DeclareTrailer("trailername");
85httpContext.Response.AppendTrailer("trailername", "TrailerValue");
103await httpContext.Response.WriteAsync("Hello World");
104httpContext.Response.AppendTrailer("TrailerName", "Trailer Value");
124httpContext.Response.ContentLength = body.Length;
125await httpContext.Response.WriteAsync(body);
128Assert.Throws<InvalidOperationException>(() => httpContext.Response.AppendTrailer("TrailerName", "Trailer Value"));
154httpContext.Response.ContentLength = body.Length * 2;
155await httpContext.Response.WriteAsync(body);
156httpContext.Response.AppendTrailer("TrailerName", "Trailer Value");
157await httpContext.Response.WriteAsync(body);
179httpContext.Response.ContentLength = body.Length;
180httpContext.Response.DeclareTrailer("TrailerName");
181await httpContext.Response.WriteAsync(body);
182httpContext.Response.AppendTrailer("TrailerName", "Trailer Value");
205httpContext.Response.ContentLength = body.Length;
206httpContext.Response.DeclareTrailer("TrailerName");
207await httpContext.Response.WriteAsync(body);
230httpContext.Response.AppendTrailer("trailername", "TrailerValue");
231await httpContext.Response.CompleteAsync();
251await httpContext.Response.WriteAsync("Hello World");
252httpContext.Response.AppendTrailer("TrailerName", "Trailer Value");
253await httpContext.Response.CompleteAsync();
273httpContext.Response.AppendTrailer("trailername", new StringValues(new[] { "TrailerValue0", "TrailerValue1" }));
301httpContext.Response.AppendTrailer("ThisIsALongerHeaderNameThatStillWorksForReals", new StringValues(values));
321httpContext.Response.AppendTrailer(headerName, headerValue);
Microsoft.AspNetCore.Server.IIS (4)
Microsoft.AspNetCore.Server.IISIntegration (6)
Microsoft.AspNetCore.Server.Kestrel.Core (1)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (5)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (5)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.Tests (7)
Microsoft.AspNetCore.Session (3)
Microsoft.AspNetCore.Session.Tests (5)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (3)
Microsoft.AspNetCore.SignalR.Tests (1)
Microsoft.AspNetCore.SpaProxy (4)
Microsoft.AspNetCore.SpaServices.Extensions (6)
Microsoft.AspNetCore.StaticAssets (15)
Microsoft.AspNetCore.StaticAssets.Tests (2)
Microsoft.AspNetCore.StaticFiles (9)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (3)
Microsoft.AspNetCore.StaticFiles.Tests (11)
Microsoft.AspNetCore.TestHost (10)
Microsoft.AspNetCore.TestHost.Tests (135)
HttpContextBuilderTests.cs (35)
41Assert.NotNull(context.Response.Headers);
42Assert.NotNull(context.Response.Body);
43Assert.Equal(404, context.Response.StatusCode);
84c.Response.Headers["TestHeader"] = "TestValue";
91Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
125c.Response.Headers["TestHeader"] = "TestValue";
128c.Response.Body.Write(bytes, 0, bytes.Length);
131c.Response.Body.Write(bytes, 0, bytes.Length);
137Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
138var reader = new StreamReader(context.Response.Body);
152c.Response.Headers["TestHeader"] = "TestValue";
153await c.Response.WriteAsync("BodyStarted" + Environment.NewLine);
155await c.Response.WriteAsync("BodyFinished");
161Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
162var reader = new StreamReader(context.Response.Body);
176c.Response.Headers["TestHeader"] = "TestValue";
177await c.Response.Body.FlushAsync();
179await c.Response.WriteAsync("BodyFinished");
185Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
187Assert.Equal("BodyFinished", new StreamReader(context.Response.Body).ReadToEnd());
198c.Response.Headers["TestHeader"] = "TestValue";
199await c.Response.Body.FlushAsync();
201await c.Response.WriteAsync("BodyFinished");
207Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
208var responseStream = context.Response.Body;
247c.Response.Headers["TestHeader"] = "TestValue";
248await c.Response.Body.FlushAsync();
250await c.Response.WriteAsync("BodyFinished");
256Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
257var responseStream = context.Response.Body;
288c.Response.Headers["TestHeader"] = "TestValue";
289await c.Response.WriteAsync("BodyStarted");
297Assert.Equal("TestValue", context.Response.Headers["TestHeader"]);
298Assert.Equal(11, context.Response.Body.Read(new byte[100], 0, 100));
300var ex = Assert.Throws<IOException>(() => context.Response.Body.Read(new byte[100], 0, 100));
Microsoft.AspNetCore.Tests (10)
Microsoft.AspNetCore.WebSockets (3)
Microsoft.AspNetCore.WebSockets.Tests (4)
MiddlewareAnalysisSample (8)
Mvc.RoutingWebSite (6)
NativeIISSample (45)
NegotiateAuthSample (1)
OpenIdConnectSample (1)
OutputCachingSample (6)
PlaintextApp (1)
QueueSharing (3)
RateLimitingSample (1)
RazorPagesWebSite (4)
RequestDecompressionSample (1)
ResponseCachingSample (3)
ResponseCompressionSample (7)
RewriteSample (1)
RoutingSandbox (11)
RoutingWebSite (14)
SampleStartups (6)
SelfHostServer (2)
ServerComparison.TestSites (30)
SessionSample (7)
SignalR.Client.FunctionalTestApp (15)
SignalRSamples (2)
SocialSample (5)
Sockets.BindTests (3)
Sockets.FunctionalTests (36)
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (19)
61context.Response.ContentLength = bytes.Length * 1024;
65await context.Response.BodyWriter.WriteAsync(new Memory<byte>(bytes, 0, bytes.Length));
113context.Response.Headers.Add(headerName, headerValue);
115await context.Response.WriteAsync("");
160httpContext.Response.ContentLength = 12;
161await httpContext.Response.WriteAsync("hello, world");
212var response = httpContext.Response;
309await context.Response.BodyWriter.WriteAsync(new Memory<byte>(scratchBuffer, 0, scratchBuffer.Length), context.RequestAborted);
372await context.Response.Body.WriteAsync(scratchBuffer, 0, scratchBuffer.Length);
527context.Response.ContentLength = responseSize;
535await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
667context.Response.ContentLength = chunks * chunkSize;
673await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
786await context.Request.Body.CopyToAsync(context.Response.Body);
888await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
963context.Response.Headers[$"X-Custom-Header"] = headerStringValues;
964context.Response.ContentLength = 0;
966await context.Response.BodyWriter.FlushAsync();
1052await context.Response.BodyWriter.WriteAsync(new Memory<byte>(chunkData, 0, chunkData.Length), context.RequestAborted);
StartRequestDelegateUrlApp (1)
StartWithIApplicationBuilderUrlApp (1)
StatusCodePagesSample (5)
SystemdTestApp (3)
Wasm.Performance.Driver (1)
WebPubSubWeb (4)
WebTransportInteractiveSampleApp (2)
WsFedSample (8)