1 override of Features
Microsoft.AspNetCore.Http (1)
DefaultHttpContext.cs (1)
139public override IFeatureCollection Features => _features.Collection ?? ContextDisposed();
837 references to Features
Aspire.Dashboard (3)
Authentication\AspirePolicyEvaluator.cs (1)
82return context.Features.Get<IAuthenticateResultFeature>()?.AuthenticateResult ?? DefaultAuthenticateResult(context);
Authentication\Connection\ConnectionTypeAuthenticationHandler.cs (1)
18var connectionTypeFeature = Context.Features.Get<IConnectionTypeFeature>();
Model\BrowserSecurityHeadersMiddleware.cs (1)
66var feature = context.Features.Get<IConnectionTypeFeature>();
BasicWebSite (3)
Controllers\RoutingController.cs (1)
13var endpointFeature = HttpContext.Features.Get<IEndpointFeature>();
Controllers\TempDataController.cs (1)
122HttpContext.Features.Get<ITrackingConsentFeature>().GrantConsent();
StartupRequestLimitSize.cs (1)
24httpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(
Binding.Http.IntegrationTests (1)
MtomBindingTestHelper.cs (1)
54context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 5_368_709_120;
CookiePolicySample (3)
Startup.cs (3)
64context.Features.Get<ITrackingConsentFeature>().GrantConsent(); 67context.Features.Get<ITrackingConsentFeature>().WithdrawConsent(); 98var feature = context.Features.Get<ITrackingConsentFeature>();
ExceptionHandlerSample (1)
Startup.cs (1)
24var error = context.Features.Get<IExceptionHandlerFeature>();
Identity.DefaultUI.WebSite (1)
Pages\Privacy.cshtml.cs (1)
13HttpContext.Features.Get<ITrackingConsentFeature>().GrantConsent();
IIS.Tests (8)
ConnectionIdFeatureTests.cs (1)
22var connectionIdFeature = ctx.Features.Get<IHttpConnectionFeature>();
HttpBodyControlFeatureTests.cs (1)
25var bodyControl = ctx.Features.Get<IHttpBodyControlFeature>();
MaxRequestBodySizeTests.cs (4)
74var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 110var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 137var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>(); 248var feature = ctx.Features.Get<IHttpMaxRequestBodySizeFeature>();
TlsHandshakeFeatureTests.cs (2)
23tlsHandshakeFeature = ctx.Features.Get<ITlsHandshakeFeature>(); 67tlsHandshakeFeature = ctx.Features.Get<ITlsHandshakeFeature>();
IISSample (1)
Startup.cs (1)
82if (context.Features.Get<IHttpUpgradeFeature>() != null)
InMemory.FunctionalTests (176)
ConnectionLimitTests.cs (1)
59var feature = context.Features.Get<IHttpUpgradeFeature>();
EventSourceTests.cs (3)
43connectionId = context.Features.Get<IHttpConnectionFeature>().ConnectionId; 46var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 151connectionId = context.Features.Get<IHttpConnectionFeature>().ConnectionId;
Http2\Http2ConnectionTests.cs (9)
331var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 497var persistentStateCollection = context.Features.Get<IPersistentStateFeature>().State; 1169if (context.Features.Get<IHttp2StreamIdFeature>().StreamId == 1) 1905var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId; 3194var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId; 3314var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId; 4217var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId; 4321var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId; 4762var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>();
Http2\Http2EndToEndTests.cs (1)
33connectionIdFromFeature = context.Features.Get<IConnectionIdFeature>().ConnectionId;
Http2\Http2StreamTests.cs (36)
362context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget; 407Assert.Equal(input, context.Features.Get<IHttpRequestFeature>().RawTarget); 2051Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2052context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 17; 2060Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2111Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2112context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 12; 2116Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2310var trailers = context.Features.Get<IHttpResponseTrailersFeature>().Trailers; 2473Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"); 2474Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Tag"); 2516context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"; 2517context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Accept"; 3178var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3211var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3247var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3289var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3332var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3372var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 3485var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 4748Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 4804Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 4872Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 4926Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 4988Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5047Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5168Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5242Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5318Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5389Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5457Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5539Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5621Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5625var resetFeature = context.Features.Get<IHttpResetFeature>(); 5705Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 5709var resetFeature = context.Features.Get<IHttpResetFeature>();
Http2\Http2TestBase.cs (7)
194_receivedRequestFields.RawTarget = context.Features.Get<IHttpRequestFeature>().RawTarget; 221_receivedRequestFields.RawTarget = context.Features.Get<IHttpRequestFeature>().RawTarget; 227var trailers = context.Features.Get<IHttpRequestTrailersFeature>().Trailers; 292var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 312var streamIdFeature = context.Features.Get<IHttp2StreamIdFeature>(); 373context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget; 386var resetFeature = context.Features.Get<IHttpResetFeature>();
Http2\Http2TimeoutTests.cs (2)
871context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = null; 927var streamId = context.Features.Get<IHttp2StreamIdFeature>().StreamId;
Http2\Http2WebSocketTests.cs (10)
22var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 81var requestBodyDetectionFeature = context.Features.Get<IHttpRequestBodyDetectionFeature>(); 84var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 160var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 332var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 395var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 396var maxRequestBodySizeFeature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 453var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 523var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 596var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>();
Http2\TlsTests.cs (1)
43var tlsFeature = context.Features.Get<ITlsApplicationProtocolFeature>();
Http3\Http3ConnectionTests.cs (1)
566var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>();
Http3\Http3StreamTests.cs (34)
210context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget; 244Assert.Equal(input, context.Features.Get<IHttpRequestFeature>().RawTarget); 830var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 860var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 894var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 954var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 986var trailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 1017Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"); 1018Assert.Throws<InvalidOperationException>(() => context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Tag"); 1048context.Features.Get<IHttpResponseTrailersFeature>().Trailers.ETag = "Custom 你好 Tag"; 1049context.Features.Get<IHttpResponseTrailersFeature>().Trailers.Accept = "Custom 你好 Accept"; 1109var resetFeature = context.Features.Get<IHttpResetFeature>(); 1144Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1193Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1247Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1294Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1343Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1395Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1495Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1550Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1607Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1665Assert.False(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1720Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1781Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1843Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1847var resetFeature = context.Features.Get<IHttpResetFeature>(); 1908Assert.True(context.Features.Get<IHttpResponseTrailersFeature>().Trailers.IsReadOnly); 1912var resetFeature = context.Features.Get<IHttpResetFeature>(); 2664Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2665context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 17; 2673Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2716Assert.False(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly); 2717context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 12; 2721Assert.True(context.Features.Get<IHttpMaxRequestBodySizeFeature>().IsReadOnly);
Http3\Http3TestBase.cs (1)
104context.Response.Headers["rawtarget"] = context.Features.Get<IHttpRequestFeature>().RawTarget;
Http3\Http3TimeoutTests.cs (1)
699context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = null;
Http3\WebTransport\WebTransportHandshakeTests.cs (1)
31var webTransportFeature = context.Features.GetRequiredFeature<IHttpWebTransportFeature>();
Http3\WebTransport\WebTransportTestUtilities.cs (1)
31var webTransportFeature = context.Features.GetRequiredFeature<IHttpWebTransportFeature>();
HttpsConnectionMiddlewareTests.cs (17)
114var feature = context.Features.Get<ISslStreamFeature>(); 145var tlsFeature = context.Features.Get<ITlsHandshakeFeature>(); 183var tlsFeature = context.Features.Get<ITlsHandshakeFeature>(); 232var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 260var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 512var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 548var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 592var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 633var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 640var lifetimeNotificationFeature = context.Features.Get<IConnectionLifetimeNotificationFeature>(); 676var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 724var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 766var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 893var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 1029var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 1076var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 1282var tlsFeature = context.Features.Get<ITlsConnectionFeature>();
KeepAliveTimeoutTests.cs (1)
272using (var stream = await httpContext.Features.Get<IHttpUpgradeFeature>().UpgradeAsync())
KestrelMetricsTests.cs (5)
219getNotificationFeatureTcs.TrySetResult(c.Features.Get<IConnectionLifetimeNotificationFeature>()); 520var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 539getNotificationFeatureTcs.TrySetResult(context.Features.Get<IConnectionLifetimeNotificationFeature>()); 686connectionId = context.Features.Get<IHttpConnectionFeature>().ConnectionId; 854connectionId = context.Features.Get<IHttpConnectionFeature>().ConnectionId;
MaxRequestBodySizeTests.cs (6)
171var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 213var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 293var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 330var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 333var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>(); 515var feature = context.Features.Get<IHttpMaxRequestBodySizeFeature>();
RequestBodyTimeoutTests.cs (3)
32context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = 116context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = null; 163context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate =
RequestTargetProcessingTests.cs (2)
69Assert.Equal(requestTarget, context.Features.Get<IHttpRequestFeature>().RawTarget); 101Assert.Equal(requestTarget, context.Features.Get<IHttpRequestFeature>().RawTarget);
RequestTests.cs (12)
184var stream = await context.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 239rawTargetTcs.TrySetResult(context.Features.Get<IHttpRequestFeature>().RawTarget); 1308var requestFeature = httpContext.Features.Get<IHttpRequestFeature>(); 1357var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 1599var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 1634context.Features.Get<IHttpMinRequestBodyDataRateFeature>().MinDataRate = 1637using (var stream = await context.Features.Get<IHttpUpgradeFeature>().UpgradeAsync()) 1688var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 1739var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 1787var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 1832var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 2140var persistentStateCollection = context.Features.Get<IPersistentStateFeature>().State;
ResponseDrainingTests.cs (1)
30context.Features.Get<IHttpMinResponseDataRateFeature>().MinDataRate = minRate;
ResponseTests.cs (7)
2377var stream = await httpContext.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 2854var feature = httpContext.Features.Get<IConnectionLifetimeFeature>(); 2887var responseFeature = httpContext.Features.Get<IHttpResponseFeature>(); 3418var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 3448var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 3479var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>(); 3514var bodyControlFeature = context.Features.Get<IHttpBodyControlFeature>();
TestTransport\RequestExtensions.cs (1)
12return request.HttpContext.Features.Get<IHttpRequestBodyDetectionFeature>()?.CanHaveBody;
UpgradeTests.cs (12)
28var feature = context.Features.Get<IHttpUpgradeFeature>(); 73var feature = context.Features.Get<IHttpUpgradeFeature>(); 123var feature = context.Features.Get<IHttpUpgradeFeature>(); 163var feature = context.Features.Get<IHttpUpgradeFeature>(); 197var feature = context.Features.Get<IHttpUpgradeFeature>(); 232var feature = context.Features.Get<IHttpUpgradeFeature>(); 273var feature = context.Features.Get<IHttpUpgradeFeature>(); 310var feature = context.Features.Get<IHttpUpgradeFeature>(); 358var feature = context.Features.Get<IHttpUpgradeFeature>(); 397var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 404var connectionTransportFeature = context.Features.Get<IConnectionTransportFeature>(); 442await context.Features.Get<IHttpUpgradeFeature>().UpgradeAsync();
InProcessWebSite (18)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (13)
225var feature = ctx.Features.Get<IServerVariablesFeature>(); 302ctx.Features.Get<IHttpRequestFeature>().Headers = headers; 303Assert.Same(headers, ctx.Features.Get<IHttpRequestFeature>().Headers); 336Assert.Null(ctx.Features.Get<IHttpResponseFeature>().ReasonPhrase); 337ctx.Features.Get<IHttpResponseFeature>().ReasonPhrase = "Set Response"; 338Assert.Equal("Set Response", ctx.Features.Get<IHttpResponseFeature>().ReasonPhrase); 342ctx.Features.Get<IHttpResponseFeature>().Headers = headers; 343Assert.Same(headers, ctx.Features.Get<IHttpResponseFeature>().Headers); 392var feature = ctx.Features.Get<IHttpResponseFeature>(); 683var feature = ctx.Features.Get<IHttpBufferingFeature>(); 1051var serverVariableFeature = ctx.Features.Get<IServerVariablesFeature>(); 1074public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString(CultureInfo.InvariantCulture) ?? "null"); 1106context.Response.WriteAsync(context.Features.Get<IHttpUpgradeFeature>() != null ? "Enabled" : "Disabled");
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (5)
29var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 39var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 100var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 144var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 156Assert.Null(context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize);
Interop.FunctionalTests (15)
Http2\Http2RequestTests.cs (1)
100protocolTcs.SetResult(c.Features.Get<ISslStreamFeature>().SslStream.SslProtocol);
Http3\Http3RequestTests.cs (8)
135connectionIdFromFeature = context.Features.Get<IConnectionIdFeature>().ConnectionId; 835var persistentStateCollection = context.Features.Get<IPersistentStateFeature>().State; 1344var feature = context.Features.Get<IHttpResponseTrailersFeature>(); 1531context.Features.Get<IHttpResetFeature>().Reset(256); 1759connectionStartedTcs1.SetResult(context.Features.Get<IConnectionLifetimeNotificationFeature>()); 1762connectionStartedTcs2.SetResult(context.Features.Get<IConnectionLifetimeNotificationFeature>()); 1765connectionStartedTcs3.SetResult(context.Features.Get<IConnectionLifetimeNotificationFeature>()); 2185context.Features.Get<IHttpResetFeature>().Reset(-1);
HttpClientHttp2InteropTests.cs (6)
591context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel 618context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel 646context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel 675context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel 710context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel 769context.Features.Get<IHttpResetFeature>().Reset(8); // Cancel
Kestrel.SampleApp (6)
ClientCertBufferingFeature.cs (5)
24var tlsFeature = context.Features.Get<ITlsConnectionFeature>(); 25var bodyFeature = context.Features.Get<IHttpRequestBodyDetectionFeature>(); 26var connectionItems = context.Features.Get<IConnectionItemsFeature>(); 32context.Features.Set<ITlsConnectionFeature>(new ClientCertBufferingFeature(tlsFeature, context)); 71var connectionItems = _context.Features.Get<IConnectionItemsFeature>();
Startup.cs (1)
37context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = 1024;
LocalizationSample (1)
Startup.cs (1)
44var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
LocalizationWebsite (1)
StartupBuilderAPIs.cs (1)
32var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
Microsoft.AspNetCore.Antiforgery (5)
AntiforgeryMiddleware.cs (2)
44context.Features.Set(AntiforgeryValidationFeature.Valid); 48context.Features.Set<IAntiforgeryValidationFeature>(new AntiforgeryValidationFeature(false, e));
Internal\DefaultAntiforgery.cs (2)
268var antiforgeryFeature = httpContext.Features.Get<IAntiforgeryFeature>(); 272httpContext.Features.Set(antiforgeryFeature);
src\Shared\HttpExtensions.cs (1)
61var routeValuesFeature = context.Features.Get<IRouteValuesFeature>();
Microsoft.AspNetCore.Antiforgery.Test (1)
DefaultAntiforgeryTest.cs (1)
1265context.HttpContext.Features.Set<IHttpResponseFeature>(testResponse);
Microsoft.AspNetCore.AsyncState (5)
AsyncContextHttpContext.cs (2)
44httpContext.Features[typeof(TypeWrapper<T>)] = value; 56value = (T?)httpContext.Features[typeof(TypeWrapper<T>)];
TypeWrapper.cs (3)
9/// We use this generic type to store values into <see cref="AspNetCore.Http.HttpContext.Features"/>. 12/// <see cref="AspNetCore.Http.HttpContext.Features"/> under type T (by the application or another library), 16/// <typeparam name="T">The type of the value to store into <see cref="AspNetCore.Http.HttpContext.Features"/>.</typeparam>
Microsoft.AspNetCore.Authentication (6)
AuthenticationHandler.cs (2)
54protected PathString OriginalPath => Context.Features.Get<IAuthenticationFeature>()?.OriginalPath ?? Request.Path; 59protected PathString OriginalPathBase => Context.Features.Get<IAuthenticationFeature>()?.OriginalPathBase ?? Request.PathBase;
AuthenticationMiddleware.cs (3)
42context.Features.Set<IAuthenticationFeature>(new AuthenticationFeature 70context.Features.Set<IHttpAuthenticationFeature>(authFeatures); 71context.Features.Set<IAuthenticateResultFeature>(authFeatures);
RequestPathBaseCookieBuilder.cs (1)
28var originalPathBase = context.Features.Get<IAuthenticationFeature>()?.OriginalPathBase ?? context.Request.PathBase;
Microsoft.AspNetCore.Authentication.Cookies (1)
CookieAuthenticationHandler.cs (1)
490var binding = Context.Features.Get<ITlsTokenBindingFeature>()?.GetProvidedTokenBindingId();
Microsoft.AspNetCore.Authentication.Negotiate (2)
NegotiateHandler.cs (2)
410return Context.Features.Get<IConnectionItemsFeature>()?.Items 416var connectionCompleteFeature = Context.Features.Get<IConnectionCompleteFeature>()
Microsoft.AspNetCore.Authentication.Negotiate.Test (4)
EventTests.cs (2)
468context.Features.Set<IConnectionItemsFeature>(connection); 469context.Features.Set<IConnectionCompleteFeature>(connection);
NegotiateHandlerTests.cs (2)
492context.Features.Set<IConnectionItemsFeature>(connection); 493context.Features.Set<IConnectionCompleteFeature>(connection);
Microsoft.AspNetCore.Authentication.Test (4)
AuthenticationMiddlewareTests.cs (4)
76var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 99var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 119var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 145var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>();
Microsoft.AspNetCore.Authorization.Policy (4)
AuthorizationMiddleware.cs (3)
159if (context.Features.Get<IAuthenticateResultFeature>() is IAuthenticateResultFeature authenticateResultFeature) 166context.Features.Set<IHttpAuthenticationFeature>(authFeatures); 167context.Features.Set<IAuthenticateResultFeature>(authFeatures);
PolicyEvaluator.cs (1)
71return context.Features.Get<IAuthenticateResultFeature>()?.AuthenticateResult ?? DefaultAuthenticateResult(context);
Microsoft.AspNetCore.Authorization.Test (9)
AuthorizationMiddlewareTests.cs (9)
785var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 809var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 848var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 872var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 898var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 934context.Features.Set<IAuthenticateResultFeature>(testAuthenticateResultFeature); 940var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 960context.Features.Set<IAuthenticateResultFeature>(testAuthenticateResultFeature); 966var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>();
Microsoft.AspNetCore.Components.Endpoints (5)
RazorComponentEndpointInvoker.cs (4)
41var isErrorHandler = context.Features.Get<IExceptionHandlerFeature>() is not null; 126var bufferingFeature = context.Features.GetRequiredFeature<IHttpResponseBodyFeature>(); 166context.Features.Get<IExceptionHandlerFeature>() == null; 188if (context.Features.Get<IAntiforgeryValidationFeature>() is { } antiForgeryValidationFeature)
Results\RazorComponentResultExecutor.cs (1)
50var isErrorHandler = httpContext.Features.Get<IExceptionHandlerFeature>() is not null;
Microsoft.AspNetCore.Components.Server (2)
DependencyInjection\ServerRazorComponentsBuilderExtensions.cs (2)
96var currentFeature = ctx.Features.Get<IHttpWebSocketFeature>(); 98ctx.Features.Set<IHttpWebSocketFeature>(new ServerComponentsSocketFeature(currentFeature!, ctx, configureConnection, disableCompression));
Microsoft.AspNetCore.CookiePolicy (4)
CookiePolicyMiddleware.cs (4)
65var feature = context.Features.Get<IResponseCookiesFeature>() ?? new ResponseCookiesFeature(context.Features); 67context.Features.Set<IResponseCookiesFeature>(new CookiesWrapperFeature(wrapper)); 68context.Features.Set<ITrackingConsentFeature>(wrapper);
Microsoft.AspNetCore.CookiePolicy.Test (22)
CookieConsentTests.cs (21)
23var feature = context.Features.Get<ITrackingConsentFeature>(); 42var feature = context.Features.Get<ITrackingConsentFeature>(); 61var feature = context.Features.Get<ITrackingConsentFeature>(); 87var feature = context.Features.Get<ITrackingConsentFeature>(); 106var feature = context.Features.Get<ITrackingConsentFeature>(); 136var feature = context.Features.Get<ITrackingConsentFeature>(); 159var feature = context.Features.Get<ITrackingConsentFeature>(); 182var feature = context.Features.Get<ITrackingConsentFeature>(); 202var feature = context.Features.Get<ITrackingConsentFeature>(); 253var feature = context.Features.Get<ITrackingConsentFeature>(); 290var feature = context.Features.Get<ITrackingConsentFeature>(); 318var feature = context.Features.Get<ITrackingConsentFeature>(); 351var feature = context.Features.Get<ITrackingConsentFeature>(); 382var feature = context.Features.Get<ITrackingConsentFeature>(); 431var feature = context.Features.Get<ITrackingConsentFeature>(); 467var feature = context.Features.Get<ITrackingConsentFeature>(); 502var feature = context.Features.Get<ITrackingConsentFeature>(); 536var feature = context.Features.Get<ITrackingConsentFeature>(); 557var feature = context.Features.Get<ITrackingConsentFeature>(); 610var feature = context.Features.Get<ITrackingConsentFeature>(); 655var feature = context.Features.Get<ITrackingConsentFeature>();
CookiePolicyTests.cs (1)
329context.Features.Set<IResponseCookiesFeature>(new TestCookieFeature());
Microsoft.AspNetCore.Diagnostics (13)
DeveloperExceptionPage\DeveloperExceptionPageMiddlewareImpl.cs (4)
93RouteValues = httpContext.Features.Get<IRouteValuesFeature>()?.RouteValues 96httpContext.Features.Set<IExceptionHandlerFeature>(exceptionHandlerFeature); 97httpContext.Features.Set<IExceptionHandlerPathFeature>(exceptionHandlerFeature); 268routeValues: httpContext.Features.Get<IRouteValuesFeature>()?.RouteValues
DiagnosticsTelemetry.cs (1)
16if (context.Features.Get<IHttpMetricsTagsFeature>() is { } tagsFeature)
ExceptionHandler\ExceptionHandlerMiddlewareImpl.cs (3)
161RouteValues = context.Features.Get<IRouteValuesFeature>()?.RouteValues 166context.Features.Set<IExceptionHandlerFeature>(exceptionHandlerFeature); 167context.Features.Set<IExceptionHandlerPathFeature>(exceptionHandlerFeature);
src\Shared\HttpExtensions.cs (1)
61var routeValuesFeature = context.Features.Get<IRouteValuesFeature>();
StatusCodePage\StatusCodePagesExtensions.cs (3)
178var routeValuesFeature = context.HttpContext.Features.Get<IRouteValuesFeature>(); 181context.HttpContext.Features.Set<IStatusCodeReExecuteFeature>(new StatusCodeReExecuteFeature() 212context.HttpContext.Features.Set<IStatusCodeReExecuteFeature?>(null);
StatusCodePage\StatusCodePagesMiddleware.cs (1)
42context.Features.Set<IStatusCodePagesFeature>(statusCodeFeature);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (7)
Latency\RequestLatencyTelemetryMiddlewareTests.cs (4)
39httpContextMock.Features.Set<IHttpResponseFeature>(fakeHttpResponseFeature); 69httpContextMock.Features.Set<IHttpResponseFeature>(fakeHttpResponseFeature); 97httpContextMock.Features.Set<IHttpResponseFeature>(fakeHttpResponseFeature); 128httpContextMock.Features.Set<IHttpResponseFeature>(fakeHttpResponseFeature);
Logging\RequestHeadersEnricherTests.cs (3)
49httpContextMock.SetupGet(c => c.Features).Returns(featureCollection); 234httpContextMock.SetupGet(c => c.Features).Returns(featureCollection); 258httpContextMock.SetupGet(c => c.Features).Throws(new ObjectDisposedException(""));
Microsoft.AspNetCore.Diagnostics.Tests (7)
DeveloperExceptionPageMiddlewareTest.cs (2)
86var feature = context.HttpContext.Features.Get<IExceptionHandlerFeature>(); 145var feature = context.HttpContext.Features.Get<IExceptionHandlerPathFeature>();
ExceptionHandlerMiddlewareTest.cs (2)
113var feature = context.Features.Get<IExceptionHandlerPathFeature>(); 255httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature());
StatusCodeMiddlewareTest.cs (3)
106var statusCodeReExecuteFeature = httpContext.Features.Get<IStatusCodeReExecuteFeature>(); 168var statusCodeReExecuteFeature = httpContext.Features.Get<IStatusCodeReExecuteFeature>(); 224var statusCodeReExecuteFeature = httpContext.Features.Get<IStatusCodeReExecuteFeature>();
Microsoft.AspNetCore.Grpc.JsonTranscoding (1)
Internal\CallHandlers\ServerCallHandlerBase.cs (1)
45httpContext.Features.Set<IServerCallContextFeature>(serverCallContext);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (1)
UnaryServerCallHandlerTests.cs (1)
1585feature = c.GetHttpContext().Features.Get<IServerCallContextFeature>();
Microsoft.AspNetCore.HeaderParsing (2)
HeaderParsingHttpRequestExtensions.cs (2)
25var feature = context.Features.Get<HeaderParsingFeature>(); 31context.Features.Set(feature);
Microsoft.AspNetCore.Hosting (3)
Internal\HostingApplicationDiagnostics.cs (2)
62httpContext.Features.Set<IHttpMetricsTagsFeature>(context.MetricsTagsFeature); 98httpContext.Features.Set<IHttpActivityFeature>(context.HttpActivityFeature);
src\Shared\HttpExtensions.cs (1)
61var routeValuesFeature = context.Features.Get<IRouteValuesFeature>();
Microsoft.AspNetCore.Hosting.Tests (4)
WebHostBuilderTests.cs (1)
1579var httpContext = application.CreateContext(ctx.Features);
WebHostTests.cs (3)
879var featuresTraceIdentifier = httpContext.Features.Get<IHttpRequestIdentifierFeature>().TraceIdentifier; 902Assert.Same(requestIdentifierFeature, httpContext.Features.Get<IHttpRequestIdentifierFeature>()); 961Assert.Throws<ObjectDisposedException>(() => capturedContext.Features.Get<IHttpRequestIdentifierFeature>());
Microsoft.AspNetCore.Http (6)
Features\FormFeature.cs (1)
364var hasInvalidToken = _request.HttpContext.Features.Get<IAntiforgeryValidationFeature>() is { IsValid: false };
Features\RouteValuesFeature.cs (1)
9/// A feature for routing values. Use <see cref="HttpContext.Features"/>
RequestFormReaderExtensions.cs (1)
32var features = request.HttpContext.Features;
src\Shared\Debugger\HttpContextDebugFormatter.cs (1)
86return response.HttpContext.Features.Get<IHttpResponseFeature>()?.ReasonPhrase ?? reasonPhrase;
Timeouts\RequestTimeoutsMiddleware.cs (2)
104context.Features.Set<IHttpRequestTimeoutFeature>(feature); 133context.Features.Set<IHttpRequestTimeoutFeature>(null);
Microsoft.AspNetCore.Http.Connections (9)
Internal\HttpConnectionContext.cs (1)
426context.Features.Get<IHttpRequestTimeoutFeature>()?.DisableTimeout();
Internal\HttpConnectionDispatcher.cs (7)
124context.Features.Get<IHttpActivityFeature>()?.Activity.AddTag("http.long_running", "true"); 243context.Features.Get<IHttpRequestTimeoutFeature>()?.DisableTimeout(); 424if ((options.Transports & HttpTransportType.WebSockets) != 0 && ServerHasWebSockets(context.Features)) 603connection.Features.Set(context.Features.Get<IHttpConnectionFeature>()); 664var authenticateResultFeature = context.Features.Get<IAuthenticateResultFeature>(); 714var existingRequestFeature = context.Features.GetRequiredFeature<IHttpRequestFeature>(); 733var existingConnectionFeature = context.Features.Get<IHttpConnectionFeature>();
Internal\Transports\ServerSentEventsServerTransport.cs (1)
38var bufferingFeature = context.Features.GetRequiredFeature<IHttpResponseBodyFeature>();
Microsoft.AspNetCore.Http.Connections.Tests (5)
HttpConnectionDispatcherTests.cs (5)
834var endpointFeature = connectionHttpContext.Features.Get<IEndpointFeature>(); 3521c.Features.Set<IHttpRequestTimeoutFeature>(new HttpRequestTimeoutFeature()); 3522Assert.True(((HttpRequestTimeoutFeature)c.Features.Get<IHttpRequestTimeoutFeature>()).Enabled); 3556var feature = Assert.IsType<HttpRequestTimeoutFeature>(context.Features.Get<IHttpContextFeature>()?.HttpContext.Features.Get<IHttpRequestTimeoutFeature>()); 3755context.Features.Set<IHttpWebSocketFeature>(new TestWebSocketConnectionFeature(sync));
Microsoft.AspNetCore.Http.Extensions (6)
HttpContextServerVariableExtensions.cs (1)
27var feature = context.Features.Get<IServerVariablesFeature>();
RequestDelegateFactory.cs (3)
1383var feature = httpContext.Features.Get<IHttpRequestBodyDetectionFeature>(); 1502var feature = httpContext.Features.Get<IHttpRequestBodyDetectionFeature>(); 1511if (httpContext.Features.Get<IAntiforgeryValidationFeature>() is { IsValid: false } antiforgeryValidationFeature)
ResponseExtensions.cs (1)
27response.HttpContext.Features.GetRequiredFeature<IHttpResponseFeature>().ReasonPhrase = null;
SendFileResponseExtensions.cs (1)
116var sendFile = response.HttpContext.Features.GetRequiredFeature<IHttpResponseBodyFeature>();
Microsoft.AspNetCore.Http.Extensions.Tests (60)
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
222httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (5)
622httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 649httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 676httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 703httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 730httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.BindAsync.cs (2)
217httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 273httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.Filters.cs (2)
236httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 239httpContext.Features.Set<IEndpointFeature>(new EndpointFeature { Endpoint = endpoint });
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (26)
37httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 72httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 107httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 145httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 183httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 224httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 261httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 297httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 324httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 371httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 404httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 454httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 493httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 500httpContext.Features.Set<ITlsConnectionFeature>(new TlsConnectionFeature(clientCertificate)); 552httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 599httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 646httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 675httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 708httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 738httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 768httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 831httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 875httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 933httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 965httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 1002httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBody.cs (9)
85httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(requestData is not null)); 105httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(false)); 235httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 276httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 316httpContext.Features.Set<IRequestBodyPipeFeature>(new PipeRequestBodyFeature(pipeReader)); 320httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 357httpContext.Features.Set<IRequestBodyPipeFeature>(new PipeRequestBodyFeature(pipeReader)); 361httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 426httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBodyOrService.cs (1)
200httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(false));
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (6)
386httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 484httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 520httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 561httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 600httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 640httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (1)
58httpContext.Features.Set<IHttpRequestLifetimeFeature>(new HttpRequestLifetimeFeature());
RequestDelegateGenerator\RuntimeCreationTests.ComplexFormBinding.cs (7)
32httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 68httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 100httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 137httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 174httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 209httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 246httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
Microsoft.AspNetCore.Http.Microbenchmarks (1)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (1)
222httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
Microsoft.AspNetCore.Http.Results.Tests (21)
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (9)
41httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 73httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 105httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 132httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 161httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 277httpContext.Features.Set(sendFileMock.Object); 297httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 330httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 351httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (12)
52httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 89httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 126httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 159httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 195httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 265httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 296httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 328httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 365httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 383httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 405httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 428httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature);
Microsoft.AspNetCore.Http.Tests (2)
Internal\DefaultHttpRequestTests.cs (1)
138var requestFeature = request.HttpContext.Features.Get<IHttpRequestFeature>();
Timeouts\RequestTimeoutsMiddlewareTests.cs (1)
325var timeoutFeature = context.Features.Get<IHttpRequestTimeoutFeature>();
Microsoft.AspNetCore.HttpLogging (6)
HttpLoggingMiddleware.cs (6)
190originalUpgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 197context.Features.Set<IHttpUpgradeFeature>(loggableUpgradeFeature); 204originalBodyFeature = context.Features.Get<IHttpResponseBodyFeature>()!; 210context.Features.Set<IHttpResponseBodyFeature>(responseBufferingStream); 272context.Features.Set(originalBodyFeature); 284context.Features.Set(originalUpgradeFeature);
Microsoft.AspNetCore.HttpLogging.Tests (6)
HttpLoggingMiddlewareTests.cs (6)
1220await c.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 1270await c.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 1324await c.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 1367await c.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 1448await c.Features.Get<IHttpUpgradeFeature>().UpgradeAsync(); 1479upgradeFeature = c.Features.Get<IHttpUpgradeFeature>();
Microsoft.AspNetCore.HttpOverrides (1)
CertificateForwardingMiddleware.cs (1)
52httpContext.Features.Set<ITlsConnectionFeature>(new CertificateForwardingFeature(_logger, header, _options));
Microsoft.AspNetCore.Localization (1)
RequestLocalizationMiddleware.cs (1)
110context.Features.Set<IRequestCultureFeature>(new RequestCultureFeature(requestCulture, winningProvider));
Microsoft.AspNetCore.Localization.Routing.Tests (3)
RouteDataRequestCultureProviderTest.cs (3)
65var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 116var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 186var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
Microsoft.AspNetCore.Localization.Tests (17)
AcceptLanguageHeaderRequestCultureProviderTest.cs (4)
36var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 77var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 117var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 161var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
CookieRequestCultureProviderTest.cs (3)
50var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 102var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 151var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
CustomRequestCultureProviderTest.cs (1)
47var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
QueryStringRequestCultureProviderTest.cs (8)
39var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 73var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 115var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 156var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 197var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 239var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 286var requestCultureFeature = context.Features.Get<IRequestCultureFeature>(); 334var requestCultureFeature = context.Features.Get<IRequestCultureFeature>();
RequestLocalizationMiddlewareTest.cs (1)
51var requestCulture = context.Features.Get<IRequestCultureFeature>();
Microsoft.AspNetCore.Mvc.Core (12)
Filters\DisableRequestSizeLimitFilter.cs (1)
43var maxRequestBodySizeFeature = context.HttpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Filters\IMiddlewareFilterFeature.cs (1)
7/// A feature in <see cref="Microsoft.AspNetCore.Http.HttpContext.Features"/> which is used to capture the
Filters\MiddlewareFilter.cs (1)
35httpContext.Features.Set<IMiddlewareFilterFeature>(feature);
Filters\MiddlewareFilterBuilder.cs (1)
64var feature = httpContext.Features.GetRequiredFeature<IMiddlewareFilterFeature>();
Filters\OutputCacheFilter.cs (1)
39var outputCachingFeature = context.HttpContext.Features.Get<IOutputCacheFeature>();
Filters\RequestFormLimitsFilter.cs (1)
34var features = context.HttpContext.Features;
Filters\RequestSizeLimitFilter.cs (1)
45var maxRequestBodySizeFeature = context.HttpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
Filters\ResponseCacheFilterExecutor.cs (1)
83var responseCachingFeature = context.HttpContext.Features.Get<IResponseCachingFeature>();
Formatters\InputFormatter.cs (1)
96var canHaveBody = context.HttpContext.Features.Get<IHttpRequestBodyDetectionFeature>()?.CanHaveBody;
ModelBinding\Binders\BodyModelBinder.cs (1)
135var hasBody = httpContext.Features.Get<IHttpRequestBodyDetectionFeature>()?.CanHaveBody;
Routing\ControllerLinkGeneratorExtensions.cs (1)
222return httpContext?.Features?.Get<IRouteValuesFeature>()?.RouteValues;
Routing\PageLinkGeneratorExtensions.cs (1)
222return httpContext?.Features.Get<IRouteValuesFeature>()?.RouteValues;
Microsoft.AspNetCore.Mvc.Core.Test (48)
Authorization\AuthorizeFilterTest.cs (1)
623httpContext.SetupGet(c => c.Features).Returns(Mock.Of<IFeatureCollection>());
Filters\DisableRequestSizeLimitFilterTest.cs (4)
23authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 42authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 84authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 105authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Filters\MiddlewareFilterTest.cs (1)
40var feature = resourceExecutingContext.HttpContext.Features.Get<IMiddlewareFilterFeature>();
Filters\RequestFormLimitsFilterTest.cs (6)
25authorizationFilterContext.HttpContext.Features.Set<IFormFeature>(null); 31var formFeature = authorizationFilterContext.HttpContext.Features.Get<IFormFeature>(); 45authorizationFilterContext.HttpContext.Features.Set<IFormFeature>(oldFormFeature); 51var actualFormFeature = authorizationFilterContext.HttpContext.Features.Get<IFormFeature>(); 91authorizationFilterContext.HttpContext.Features.Set<IFormFeature>(null); 116authorizationFilterContext.HttpContext.Features.Set<IFormFeature>(
Filters\RequestSizeLimitFilterTest.cs (4)
24authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 45authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 89authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize); 111authorizationFilterContext.HttpContext.Features.Set<IHttpMaxRequestBodySizeFeature>(httpMaxRequestBodySize);
Filters\ResponseCacheFilterExecutorTest.cs (2)
402context.HttpContext.Features.Set<IResponseCachingFeature>(new ResponseCachingFeature()); 408Assert.Equal(varyOutput, context.HttpContext.Features.Get<IResponseCachingFeature>().VaryByQueryKeys);
ResponseCacheAttributeTest.cs (2)
213context.HttpContext.Features.Set<IResponseCachingFeature>(new ResponseCachingFeature()); 227Assert.Equal(varyByQueryKeys, context.HttpContext.Features.Get<IResponseCachingFeature>().VaryByQueryKeys);
Routing\MvcRouteHandlerTests.cs (1)
112.Setup(h => h.Features[typeof(IRoutingFeature)])
Routing\UrlHelperTestBase.cs (6)
888httpContext.SetupGet(h => h.Features).Returns(new FeatureCollection()); 910httpContext.SetupGet(h => h.Features).Returns(new FeatureCollection()); 929httpContext.SetupGet(h => h.Features).Returns(new FeatureCollection()); 968urlHelper.ActionContext.HttpContext.Features.Set<IRouteValuesFeature>(new RouteValuesFeature 1007urlHelper.ActionContext.HttpContext.Features.Set<IRouteValuesFeature>(new RouteValuesFeature 1047urlHelper.ActionContext.HttpContext.Features.Set<IRouteValuesFeature>(new RouteValuesFeature
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (9)
41httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 73httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 105httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 132httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 161httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 277httpContext.Features.Set(sendFileMock.Object); 297httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 330httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 351httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile);
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (12)
52httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 89httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 126httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 159httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 195httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 265httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 296httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 328httpContext.Features.Set<IHttpResponseBodyFeature>(sendFile); 365httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 383httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 405httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature); 428httpContext.Features.Set<IHttpResponseBodyFeature>(sendFileFeature);
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (2)
XmlDataContractSerializerInputFormatterTest.cs (1)
749httpContext.SetupGet(c => c.Features).Returns(features.Object);
XmlSerializerInputFormatterTest.cs (1)
684httpContext.SetupGet(c => c.Features).Returns(features.Object);
Microsoft.AspNetCore.Mvc.FunctionalTests (2)
AntiforgeryMiddlewareTest.cs (2)
105context.Features.Set<IHttpMaxRequestBodySizeFeature>(new FakeHttpMaxRequestBodySizeFeature(5_000_000)); 111context.Request.Body = new SizeLimitedStream(context.Request.Body, context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize);
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (2)
NewtonsoftJsonInputFormatterTest.cs (1)
449httpContext.SetupGet(c => c.Features).Returns(features.Object);
NewtonsoftJsonPatchInputFormatterTest.cs (1)
268httpContext.SetupGet(c => c.Features).Returns(features.Object);
Microsoft.AspNetCore.Mvc.RazorPages (2)
Filters\PageViewDataAttributeFilter.cs (1)
27context.HttpContext.Features.Set<IViewDataValuesProviderFeature>(this);
Infrastructure\PageResultExecutor.cs (1)
99var viewDataValuesProvider = pageContext.HttpContext.Features.Get<IViewDataValuesProviderFeature>();
Microsoft.AspNetCore.Mvc.ViewFeatures (5)
Filters\AntiforgeryMiddlewareAuthorizationFilter.cs (1)
21var antiforgeryValidationFeature = context.HttpContext.Features.Get<IAntiforgeryValidationFeature>();
Filters\ControllerViewDataAttributeFilter.cs (1)
26context.HttpContext.Features.Set<IViewDataValuesProviderFeature>(this);
SkipStatusCodePagesAttribute.cs (1)
26var statusCodeFeature = context.HttpContext.Features.Get<IStatusCodePagesFeature>();
ViewComponentResultExecutor.cs (1)
138var viewDataValuesProvider = viewContext.HttpContext.Features.Get<IViewDataValuesProviderFeature>();
ViewExecutor.cs (1)
235var viewDataValuesProvider = viewContext.HttpContext.Features.Get<IViewDataValuesProviderFeature>();
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (1)
SkipStatusCodePagesAttributeTest.cs (1)
22resourceExecutingContext.HttpContext.Features.Set<IStatusCodePagesFeature>(statusCodePagesFeature);
Microsoft.AspNetCore.OutputCaching (1)
OutputCacheMiddleware.cs (1)
505context.Features.Set<IOutputCacheFeature?>(null);
Microsoft.AspNetCore.OutputCaching.Tests (2)
OutputCacheMiddlewareTests.cs (1)
523context.HttpContext.Features.Set<IOutputCacheFeature>(new OutputCacheFeature(context));
TestUtils.cs (1)
71var feature = context.Features.Get<IHttpBodyControlFeature>();
Microsoft.AspNetCore.Owin (9)
OwinEnvironment.cs (6)
40if (context.Features.Get<IHttpRequestFeature>() == null) 44if (context.Features.Get<IHttpResponseFeature>() == null) 104if (context.Features.Get<IHttpRequestLifetimeFeature>() != null) 390object featureInstance = context.Features[FeatureInterface]; 406var feature = context.Features[FeatureInterface]; 416context.Features[FeatureInterface] = feature;
OwinExtensions.cs (3)
47var owinEnvFeature = httpContext.Features.Get<IOwinEnvironmentFeature>(); 129return next(httpContext.Features.Get<IOwinEnvironmentFeature>().Environment); 140context.Features.Set<IOwinEnvironmentFeature>(new OwinEnvironmentFeature() { Environment = env });
Microsoft.AspNetCore.RequestDecompression (1)
RequestDecompressionMiddleware.cs (1)
63?? context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize;
Microsoft.AspNetCore.RequestDecompression.Tests (7)
RequestDecompressionMiddlewareTests.cs (7)
219context.Features.Set<IHttpMaxRequestBodySizeFeature>( 289context.Features.Set<IHttpMaxRequestBodySizeFeature>( 365context.Features.Set<IHttpMaxRequestBodySizeFeature>( 460context.Features.Set<IEndpointFeature>( 462context.Features.Set<IHttpMaxRequestBodySizeFeature>( 546context.Features.Set<IHttpMaxRequestBodySizeFeature>( 704context.Features.Set<IHttpMaxRequestBodySizeFeature>(
Microsoft.AspNetCore.ResponseCaching (4)
ResponseCachingMiddleware.cs (4)
257var varyQueryKeys = new StringValues(context.HttpContext.Features.Get<IResponseCachingFeature>()?.VaryByQueryKeys); 394if (context.Features.Get<IResponseCachingFeature>() != null) 398context.Features.Set<IResponseCachingFeature>(new ResponseCachingFeature()); 417context.Features.Set<IResponseCachingFeature?>(null);
Microsoft.AspNetCore.ResponseCaching.Tests (10)
ResponseCachingMiddlewareTests.cs (1)
908responseCachingFeatureAdded = httpContext.Features.Get<IResponseCachingFeature>() != null;
ResponseCachingTests.cs (8)
316var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "query" }); 338var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryA", "queryb" }); 360var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" }); 382var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryB", "QueryA" }); 404var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" }); 426var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "query" }); 448var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "QueryA", "QueryB" }); 470var builders = TestUtils.CreateBuildersWithResponseCaching(contextAction: context => context.Features.Get<IResponseCachingFeature>().VaryByQueryKeys = new[] { "*" });
TestUtils.cs (1)
96var feature = context.Features.Get<IHttpBodyControlFeature>();
Microsoft.AspNetCore.ResponseCompression (7)
ResponseCompressionMiddleware.cs (6)
48var originalBodyFeature = context.Features.Get<IHttpResponseBodyFeature>(); 49var originalCompressionFeature = context.Features.Get<IHttpsCompressionFeature>(); 54context.Features.Set<IHttpResponseBodyFeature>(compressionBody); 55context.Features.Set<IHttpsCompressionFeature>(compressionBody); 64context.Features.Set(originalBodyFeature); 65context.Features.Set(originalCompressionFeature);
ResponseCompressionProvider.cs (1)
165var httpsMode = context.Features.Get<IHttpsCompressionFeature>()?.Mode ?? HttpsCompressionMode.Default;
Microsoft.AspNetCore.ResponseCompression.Tests (16)
ResponseCompressionMiddlewareTest.cs (16)
522var feature = context.Features.Get<IHttpsCompressionFeature>(); 585var feature = context.Features.Get<IHttpsCompressionFeature>(); 729var feature = context.Features.Get<IHttpBodyControlFeature>(); 850context.Features.Get<IHttpResponseBodyFeature>().DisableBuffering(); 852var feature = context.Features.Get<IHttpBodyControlFeature>(); 920context.Features.Get<IHttpResponseBodyFeature>().DisableBuffering(); 984context.Features.Get<IHttpResponseBodyFeature>().DisableBuffering(); 1040fakeSendFile = new FakeSendFileFeature(context.Features.Get<IHttpResponseBodyFeature>()); 1041context.Features.Set<IHttpResponseBodyFeature>(fakeSendFile); 1050var sendFile = context.Features.Get<IHttpResponseBodyFeature>(); 1090fakeSendFile = new FakeSendFileFeature(context.Features.Get<IHttpResponseBodyFeature>()); 1091context.Features.Set<IHttpResponseBodyFeature>(fakeSendFile); 1100var sendFile = context.Features.Get<IHttpResponseBodyFeature>(); 1140fakeSendFile = new FakeSendFileFeature(context.Features.Get<IHttpResponseBodyFeature>()); 1141context.Features.Set<IHttpResponseBodyFeature>(fakeSendFile); 1149var feature = context.Features.Get<IHttpResponseBodyFeature>();
Microsoft.AspNetCore.Rewrite (4)
PatternSegments\ServerProtocolSegment.cs (1)
12return context.HttpContext.Features.Get<IHttpRequestFeature>()?.Protocol;
RewriteMiddleware.cs (1)
80var routeValuesFeature = context.Features.Get<IRouteValuesFeature>();
UrlActions\CustomResponseAction.cs (2)
29context.HttpContext.Features.GetRequiredFeature<IHttpResponseFeature>().ReasonPhrase = StatusReason; 34var feature = context.HttpContext.Features.Get<IHttpBodyControlFeature>();
Microsoft.AspNetCore.Rewrite.Tests (3)
IISUrlRewrite\ServerVariableTests.cs (2)
63httpContext.Features.Set<IServerVariablesFeature>(new TestServerVariablesFeature(new Dictionary<string, string> 111httpContext.Features.Set<IServerVariablesFeature>(new TestServerVariablesFeature(new Dictionary<string, string>
PatternSegments\ServerProtocolSegmentTests.cs (1)
18context.HttpContext.Features.Set<IHttpRequestFeature>(new HttpRequestFeature { Protocol = "http" });
Microsoft.AspNetCore.Routing (4)
DefaultLinkGenerator.cs (1)
319return httpContext?.Features.Get<IRouteValuesFeature>()?.RouteValues;
EndpointRoutingMiddleware.cs (1)
311var maxRequestBodySizeFeature = context.Features.Get<IHttpMaxRequestBodySizeFeature>();
RouterMiddleware.cs (1)
62httpContext.Features.Set<IRoutingFeature>(routingFeature);
src\Shared\HttpExtensions.cs (1)
61var routeValuesFeature = context.Features.Get<IRouteValuesFeature>();
Microsoft.AspNetCore.Routing.Abstractions (2)
RoutingHttpContextExtensions.cs (2)
25var routingFeature = httpContext.Features.Get<IRoutingFeature>(); 41return httpContext.Features.Get<IRouteValuesFeature>()?.RouteValues[key];
Microsoft.AspNetCore.Routing.FunctionalTests (3)
MinimalFormTests.cs (3)
377var form = context.Features.Get<IFormFeature>()?.ReadForm(); 445context.Features.Set<IHttpMaxRequestBodySizeFeature>(new FakeHttpMaxRequestBodySizeFeature(5_000_000)); 451context.Request.Body = new SizeLimitedStream(context.Request.Body, context.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize);
Microsoft.AspNetCore.Routing.Tests (6)
EndpointRoutingMiddlewareFormOptionsTest.cs (4)
46var formFeature = httpContext.Features.Get<IFormFeature>(); 80var formFeature = httpContext.Features.Get<IFormFeature>(); 118var formFeature = httpContext.Features.Get<IFormFeature>(); 154var formFeature = httpContext.Features.Get<IFormFeature>();
RouterMiddlewareTest.cs (2)
35var routingFeature = context.Features.Get<IRoutingFeature>(); 38Assert.NotNull(context.Features.Get<IRouteValuesFeature>());
Microsoft.AspNetCore.Server.HttpSys (1)
AuthenticationHandler.cs (1)
39_requestContext = context.Features.Get<RequestContext>();
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (112)
DelegateTests.cs (7)
53var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 86var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 117var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 153var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 173var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 202var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>(); 235var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>();
Http2Tests.cs (10)
35var feature = httpContext.Features.Get<IHttpUpgradeFeature>(); 617var feature = httpContext.Features.Get<IHttpResetFeature>(); 639var feature = httpContext.Features.Get<IHttpResetFeature>(); 662var feature = httpContext.Features.Get<IHttpResetFeature>(); 704var feature = httpContext.Features.Get<IHttpResetFeature>(); 751var feature = httpContext.Features.Get<IHttpResetFeature>(); 801var feature = httpContext.Features.Get<IHttpResetFeature>(); 853var feature = httpContext.Features.Get<IHttpResetFeature>(); 899var feature = httpContext.Features.Get<IHttpResetFeature>(); 948var feature = httpContext.Features.Get<IHttpResetFeature>();
Http3Tests.cs (2)
163httpContext.Features.Get<IHttpResetFeature>().Reset(0x010b); // H3_REQUEST_REJECTED 193httpContext.Features.Get<IHttpResetFeature>().Reset(0x010c); // H3_REQUEST_CANCELLED
HttpsTests.cs (7)
81var tls = httpContext.Features.Get<ITlsConnectionFeature>(); 106var tls = httpContext.Features.Get<ITlsConnectionFeature>(); 136var tlsFeature = httpContext.Features.Get<ITlsHandshakeFeature>(); 156var tlsFeature = httpContext.Features.Get<ITlsHandshakeFeature>(); 202var tlsFeature = httpContext.Features.Get<ITlsHandshakeFeature>(); 203var requestInfoFeature = httpContext.Features.Get<IHttpSysRequestInfoFeature>(); 242var requestTimingFeature = httpContext.Features.Get<IHttpSysRequestTimingFeature>();
OpaqueUpgradeTests.cs (11)
29var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 56var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 87var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 113var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 134var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 140var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 173var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 220var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 262var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 285var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>(); 312var opaqueFeature = httpContext.Features.Get<IHttpUpgradeFeature>();
RequestBodyLimitTests.cs (21)
25httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 26var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 48var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 70var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 92httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 93var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 115var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 137var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 159httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 160var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 185var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 210var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 235httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 236var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 261var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 285var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 312httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 313var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 339var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 363var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 387var feature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>();
RequestBodyTests.cs (4)
31httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 51httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 127httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 151httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
RequestHeaderTests.cs (3)
109var request = httpContext.Features.Get<RequestContext>().Request; 132var request = httpContext.Features.Get<RequestContext>().Request; 155var request = httpContext.Features.Get<RequestContext>().Request;
RequestTests.cs (20)
28var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 42var connectionInfo = httpContext.Features.Get<IHttpConnectionFeature>(); 50var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>(); 77var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 100var connectionInfo = httpContext.Features.Get<IHttpConnectionFeature>(); 113var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>(); 141var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 163var connectionInfo = httpContext.Features.Get<IHttpConnectionFeature>(); 176var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>(); 212var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 213var connectionInfo = httpContext.Features.Get<IHttpConnectionFeature>(); 214var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>(); 246var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 263var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 312var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 313var requestIdentifierFeature = httpContext.Features.Get<IHttpRequestIdentifierFeature>(); 351var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 408var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 432var requestInfo = httpContext.Features.Get<IHttpRequestFeature>(); 453var requestInfo = httpContext.Features.Get<IHttpRequestFeature>();
ResponseBodyTests.cs (6)
114httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 143httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 170httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 214httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 288httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true; 322httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
ResponseHeaderTests.cs (6)
46var responseInfo = httpContext.Features.Get<IHttpResponseFeature>(); 72var responseInfo = httpContext.Features.Get<IHttpResponseFeature>(); 97var responseInfo = httpContext.Features.Get<IHttpResponseFeature>(); 122var responseInfo = httpContext.Features.Get<IHttpResponseFeature>(); 143var responseInfo = httpContext.Features.Get<IHttpResponseFeature>(); 219httpContext.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
ResponseSendFileTests.cs (13)
42var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 67var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 86var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 105var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 124var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 144var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 164var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 183var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 201var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 220var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 241var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 262var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>(); 290var sendFile = httpContext.Features.Get<IHttpResponseBodyFeature>();
ResponseTests.cs (1)
67httpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "CustomReasonPhrase"; // TODO?
Utilities.cs (1)
174return request.HttpContext.Features.Get<IHttpRequestBodyDetectionFeature>()?.CanHaveBody;
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (1)
DelegateOutOfProcTests.cs (1)
55var delegateFeature = httpContext.Features.Get<IHttpSysRequestDelegationFeature>();
Microsoft.AspNetCore.Server.IIS (1)
Core\IISServerAuthenticationHandlerInternal.cs (1)
60_iisHttpContext = context.Features.GetRequiredFeature<IISHttpContext>();
Microsoft.AspNetCore.Server.IISIntegration (5)
AuthenticationHandler.cs (1)
52_user = context.Features.Get<WindowsPrincipal>(); // See IISMiddleware
IISMiddleware.cs (4)
128var bodySizeFeature = httpContext.Features.Get<IHttpMaxRequestBodySizeFeature>(); 140httpContext.Features.Set<ITlsConnectionFeature>(new ForwardedTlsConnectionFeature(_logger, header)); 151httpContext.Features.Set(user); 164httpContext.Features.Set<IHttpUpgradeFeature?>(null);
Microsoft.AspNetCore.Server.IISIntegration.Tests (2)
IISMiddlewareTests.cs (2)
40var auth = context.Features.Get<IHttpAuthenticationFeature>(); 78var auth = context.Features.Get<IHttpAuthenticationFeature>();
Microsoft.AspNetCore.Session (2)
SessionMiddleware.cs (2)
86context.Features.Set<ISessionFeature>(feature); 94context.Features.Set<ISessionFeature?>(null);
Microsoft.AspNetCore.Session.Tests (2)
SessionTests.cs (2)
523Assert.Null(httpContext.Features.Get<ISessionFeature>()); 574Assert.Null(httpContext.Features.Get<ISessionFeature>());
Microsoft.AspNetCore.StaticAssets (3)
Development\StaticAssetDevelopmentRuntimeHandler.cs (3)
43var originalFeature = context.Features.GetRequiredFeature<IHttpResponseBodyFeature>(); 52context.Features.Set<IHttpResponseBodyFeature>(new RuntimeStaticAssetResponseBodyFeature(originalFeature, context, asset)); 56context.Features.Set(originalFeature);
Microsoft.AspNetCore.StaticFiles (1)
StaticFileContext.cs (1)
410var responseCompressionFeature = _context.Features.Get<IHttpsCompressionFeature>();
Microsoft.AspNetCore.StaticFiles.Tests (1)
StaticFileMiddlewareTests.cs (1)
100ctx.Features.Set(mockSendFile.Object);
Microsoft.AspNetCore.TestHost (14)
ClientHandler.cs (3)
155context.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(canHaveBody)); 197var responseTrailersFeature = context.Features.Get<IHttpResponseTrailersFeature>(); 213response.ReasonPhrase = httpContext.Features.GetRequiredFeature<IHttpResponseFeature>().ReasonPhrase;
HttpContextBuilder.cs (10)
51_httpContext.Features.Set<IHttpBodyControlFeature>(this); 52_httpContext.Features.Set<IHttpResponseFeature>(_responseFeature); 53_httpContext.Features.Set<IHttpResponseBodyFeature>(_responseFeature); 54_httpContext.Features.Set<IHttpRequestLifetimeFeature>(_requestLifetimeFeature); 55_httpContext.Features.Set<IHttpResponseTrailersFeature>(_responseTrailersFeature); 56_httpContext.Features.Set<IHttpUpgradeFeature>(new UpgradeFeature()); 95_httpContext.Features.Set<IHttpResetFeature>(this); 101_testContext = _application.CreateContext(_httpContext.Features); 233foreach (var pair in _httpContext.Features) 237var serverResponseFeature = _httpContext.Features.GetRequiredFeature<IHttpResponseFeature>();
WebSocketClient.cs (1)
92context.Features.Set<IHttpWebSocketFeature>(webSocketFeature);
Microsoft.AspNetCore.TestHost.Tests (17)
ClientHandlerTests.cs (1)
61Assert.Null(context.Features.Get<IHttpResponseFeature>().ReasonPhrase);
HttpContextBuilderTests.cs (2)
44Assert.Null(context.Features.Get<IHttpResponseFeature>().ReasonPhrase); 127c.Features.Get<IHttpBodyControlFeature>().AllowSynchronousIO = true;
ResponseResetTests.cs (7)
23var feature = httpContext.Features.Get<IHttpResetFeature>(); 39var feature = httpContext.Features.Get<IHttpResetFeature>(); 55var feature = httpContext.Features.Get<IHttpResetFeature>(); 74var feature = httpContext.Features.Get<IHttpResetFeature>(); 93var feature = httpContext.Features.Get<IHttpResetFeature>(); 115var feature = httpContext.Features.Get<IHttpResetFeature>(); 141var feature = httpContext.Features.Get<IHttpResetFeature>();
TestClientTests.cs (2)
1027var upgradeFeature = c.Features.Get<IHttpUpgradeFeature>(); 1033var webSocketFeature = c.Features.Get<IHttpWebSocketFeature>();
TestServerTests.cs (2)
484context.Features.Set<IServiceProvidersFeature>(this); 526context.Features.Set<IServiceProvidersFeature>(this);
Utilities.cs (1)
15return request.HttpContext.Features.Get<IHttpRequestBodyDetectionFeature>()?.CanHaveBody;
WebSocketClientTests.cs (2)
102var upgradeFeature = c.Features.Get<IHttpUpgradeFeature>(); 107var webSocketFeature = c.Features.Get<IHttpWebSocketFeature>();
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
2452var authFeature = context.Features.Get<IAuthenticationFeature>(); 2492var authFeature = context.Features.Get<IAuthenticationFeature>();
Microsoft.AspNetCore.WebSockets (6)
WebSocketMiddleware.cs (6)
52/// sets the <see cref="IHttpWebSocketFeature"/> on the <see cref="HttpContext.Features"/>. 59var upgradeFeature = context.Features.Get<IHttpUpgradeFeature>(); 60var connectFeature = context.Features.Get<IHttpExtendedConnectFeature>(); 61if ((upgradeFeature != null || connectFeature != null) && context.Features.Get<IHttpWebSocketFeature>() == null) 64context.Features.Set<IHttpWebSocketFeature>(webSocketFeature); 211_context.Features.Get<IHttpRequestTimeoutFeature>()?.DisableTimeout();
Microsoft.AspNetCore.WebSockets.Tests (3)
Http2WebSocketTests.cs (1)
40httpContext.Features.Set<IHttpExtendedConnectFeature>(new ConnectFeature()
WebSocketMiddlewareTests.cs (2)
781context.Features.Set<IHttpRequestTimeoutFeature>(new HttpRequestTimeoutFeature()); 783var feature = Assert.IsType<HttpRequestTimeoutFeature>(context.Features.Get<IHttpRequestTimeoutFeature>());
Mvc.RoutingWebSite (1)
Controllers\RoutingController.cs (1)
13var endpointFeature = HttpContext.Features.Get<IEndpointFeature>();
NativeIISSample (1)
Startup.cs (1)
89if (context.Features.Get<IHttpUpgradeFeature>() != null)
OutputCachingSample (1)
Startup.cs (1)
68var cacheContext = context.Features.Get<IOutputCacheFeature>()?.Context;
ResponseCompressionSample (1)
Startup.cs (1)
48context.Features.Get<IHttpResponseBodyFeature>().DisableBuffering();
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
73var endpoint = context.HttpContext.Features.Get<IEndpointFeature>()?.Endpoint;
Sockets.FunctionalTests (8)
SocketTransportTests.cs (1)
37var socket = context.Features.Get<IConnectionSocketFeature>().Socket;
src\Servers\Kestrel\test\FunctionalTests\Http2\HandshakeTests.cs (2)
71var tlsFeature = context.Features.Get<ITlsApplicationProtocolFeature>(); 99var tlsFeature = context.Features.Get<ITlsApplicationProtocolFeature>();
src\Servers\Kestrel\test\FunctionalTests\RequestTests.cs (4)
742var connectionLifetimeFeature = context.Features.Get<IConnectionLifetimeFeature>(); 774var connectionLifetimeFeature = context.Features.Get<IConnectionLifetimeFeature>(); 810var connectionLifetimeFeature = context.Features.Get<IConnectionLifetimeFeature>(); 861var lifetime = httpContext.Features.Get<IHttpRequestLifetimeFeature>();
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (1)
214var lifetime = httpContext.Features.Get<IHttpRequestLifetimeFeature>();
StatusCodePagesSample (1)
Startup.cs (1)
45var statusCodePagesFeature = context.Features.Get<IStatusCodePagesFeature>();
VersioningWebSite (1)
Controllers\RoutingController.cs (1)
13var endpointFeature = HttpContext.Features.Get<IEndpointFeature>();
WebTransportInteractiveSampleApp (1)
Program.cs (1)
56var feature = context.Features.GetRequiredFeature<IHttpWebTransportFeature>();
WebTransportSampleApp (1)
Program.cs (1)
26var feature = context.Features.GetRequiredFeature<IHttpWebTransportFeature>();