Base:
property
Features
Microsoft.AspNetCore.Http.HttpContext.Features
1 write to Features
Microsoft.AspNetCore.Http.Extensions.Tests (1)
RequestDelegateFactoryTests.cs (1)
3263Features =
190 references to Features
Aspire.Dashboard.Tests (1)
BrowserSecurityHeadersMiddlewareTests.cs (1)
71httpContext.Features.Set<IConnectionTypeFeature>(new TestConnectionTypeFeature { ConnectionTypes = [ConnectionType.Otlp] });
Microsoft.AspNetCore.Antiforgery.Test (2)
AntiforgeryMiddlewareTest.cs (1)
27Assert.True(httpContext.Features.Get<IAntiforgeryValidationFeature>()?.IsValid);
DefaultAntiforgeryTest.cs (1)
1413httpContext.Features.Set(antiforgeryFeature);
Microsoft.AspNetCore.Components.Endpoints.Tests (2)
EndpointHtmlRendererTest.cs (1)
765ctx.Features.Set(responseMock.Object);
RazorComponentResultTest.cs (1)
244httpContext.Features.Set(responseMock.Object);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (2)
Latency\AddServerTimingHeaderMiddlewareTests.cs (1)
39context.Features.Set<IHttpResponseFeature>(fakeHttpResponseFeature);
Latency\RequestLatencyTelemetryMiddlewareTests.cs (1)
221httpContextMock.Features.Set(feature.Object);
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (2)
Infrastructure\TestHelpers.cs (1)
31httpContext.Features.Set<IHttpRequestLifetimeFeature>(new HttpRequestLifetimeFeature(cancellationToken));
JsonTranscodingServerCallContextTests.cs (1)
68httpContext.Features.Set<IHttpRequestLifetimeFeature>(new HttpRequestLifetimeFeature(cancellationToken));
Microsoft.AspNetCore.Hosting.Tests (16)
HostingApplicationTests.cs (9)
28var context = hostingApplication.CreateContext(httpContext.Features); 43var context = hostingApplication.CreateContext(httpContext.Features); 56var features = new FeaturesWithContext<Context>(new DefaultHttpContext().Features); 79var features = new FeaturesWithContext<Context>(new DefaultHttpContext().Features); 107var context = hostingApplication.CreateContext(httpContext.Features); 152httpContext.Features.Set<IHttpActivityFeature>(overridenFeature); 154var context = hostingApplication.CreateContext(httpContext.Features); 169httpContext.Features.Set<IHttpActivityFeature>(new TestHttpActivityFeature()); 170var context = hostingApplication.CreateContext(httpContext.Features);
HostingMetricsTests.cs (7)
37var context1 = hostingApplication.CreateContext(httpContext.Features); 49var context2 = hostingApplication.CreateContext(httpContext.Features); 64var context3 = hostingApplication.CreateContext(httpContext.Features); 135var context1 = hostingApplication.CreateContext(httpContext.Features); 171httpContext.Features.Set<IHttpMetricsTagsFeature>(overridenFeature); 173var context = hostingApplication.CreateContext(httpContext.Features); 174var contextFeature = httpContext.Features.Get<IHttpMetricsTagsFeature>();
Microsoft.AspNetCore.Http (11)
DefaultHttpContext.cs (5)
54Features.Set<IHttpRequestFeature>(new HttpRequestFeature()); 55Features.Set<IHttpResponseFeature>(new HttpResponseFeature()); 56Features.Set<IHttpResponseBodyFeature>(new StreamResponseBodyFeature(Stream.Null)); 148public override ConnectionInfo Connection => _connection ?? (_connection = new DefaultConnectionInfo(Features)); 151public override WebSocketManager WebSockets => _websockets ?? (_websockets = new DefaultWebSocketManager(Features));
Internal\DefaultHttpRequest.cs (3)
29_features.Initalize(context.Features); 34_features.Initalize(_context.Features); 39_features.Initalize(_context.Features, revision);
Internal\DefaultHttpResponse.cs (3)
27_features.Initalize(context.Features); 32_features.Initalize(_context.Features); 37_features.Initalize(_context.Features, revision);
Microsoft.AspNetCore.Http.Abstractions.Tests (8)
EndpointHttpContextExtensionsTests.cs (8)
28context.Features.Set<IEndpointFeature>(new EndpointFeature 46context.Features.Set<IEndpointFeature>(new EndpointFeature 68Assert.Null(context.Features.Get<IEndpointFeature>()); 82var feature = context.Features.Get<IEndpointFeature>(); 97context.Features.Set<IEndpointFeature>(initialFeature); 104var feature = context.Features.Get<IEndpointFeature>(); 119context.Features.Set<IEndpointFeature>(initialFeature); 125var feature = context.Features.Get<IEndpointFeature>();
Microsoft.AspNetCore.Http.Connections.Tests (26)
HttpConnectionDispatcherTests.cs (24)
262context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 263context.Features.Set<IHttpWebSocketFeature>(new TestWebSocketConnectionFeature()); 300context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 491var ws = (TestWebSocketConnectionFeature)context.Features.Get<IHttpWebSocketFeature>(); 853context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 1462var ws = (TestWebSocketConnectionFeature)context1.Features.Get<IHttpWebSocketFeature>(); 2265context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 2291context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 2320context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 2349context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 2402var websocketFeature = (TestWebSocketConnectionFeature)context.Features.Get<IHttpWebSocketFeature>(); 2434websocketFeature = (TestWebSocketConnectionFeature)context.Features.Get<IHttpWebSocketFeature>(); 2476var websocketFeature = (TestWebSocketConnectionFeature)context.Features.Get<IHttpWebSocketFeature>(); 2861var websocket = (TestWebSocketConnectionFeature)context.Features.Get<IHttpWebSocketFeature>(); 2929context.Features.Set<IHttpRequestLifetimeFeature>(lifetimeFeature); 3125context.Features.Set<IHttpActivityFeature>(activityFeature); 3579context.Features.Set<IHttpRequestTimeoutFeature>(new HttpRequestTimeoutFeature()); 3580Assert.True(((HttpRequestTimeoutFeature)context.Features.Get<IHttpRequestTimeoutFeature>()).Enabled); 3584Assert.False(((HttpRequestTimeoutFeature)context.Features.Get<IHttpRequestTimeoutFeature>()).Enabled); 3586context.Features.Set<IHttpRequestTimeoutFeature>(new HttpRequestTimeoutFeature()); 3587Assert.True(((HttpRequestTimeoutFeature)context.Features.Get<IHttpRequestTimeoutFeature>()).Enabled); 3590Assert.False(((HttpRequestTimeoutFeature)context.Features.Get<IHttpRequestTimeoutFeature>()).Enabled); 3691context.Features.Set<IHttpResponseFeature>(new ResponseFeature()); 3733context.Features.Set<IHttpResponseFeature>(new ResponseFeature());
ServerSentEventsTests.cs (1)
50context.Features.Set<IHttpResponseBodyFeature>(feature);
WebSocketsTests.cs (1)
375context.Features.Set<IHttpWebSocketFeature>(feature);
Microsoft.AspNetCore.Http.Extensions.Tests (10)
RequestDelegateFactoryTests.cs (6)
856httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 889httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(false)); 1225httpContext.Features.Set<IHttpRequestLifetimeFeature>(new HttpRequestLifetimeFeature()); 1937httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 1970httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true)); 2881httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new RequestBodyDetectionFeature(true));
ResponseExtensionTests.cs (1)
29context.Features.Set<IHttpResponseFeature>(new StartedResponseFeature());
SendFileResponseExtensionsTests.cs (3)
24context.Features.Set<IHttpResponseBodyFeature>(fakeFeature); 66context.Features.Set<IHttpResponseBodyFeature>(fakeFeature); 92context.Features.Set<IHttpResponseBodyFeature>(fakeFeature);
Microsoft.AspNetCore.Http.Tests (60)
ApplicationBuilderTests.cs (1)
33httpContext.Features.Set<IHttpResponseFeature>(responseFeature);
DefaultHttpContextTests.cs (10)
37context.Features.Set<ISessionFeature>(feature); 69context.Features.Set<ISessionFeature>(feature); 111Assert.Null(context.Features.Get<IItemsFeature>()); 113Assert.NotNull(context.Features.Get<IItemsFeature>()); 125Assert.Null(context.Features.Get<IHttpRequestIdentifierFeature>()); 127Assert.NotNull(context.Features.Get<IHttpRequestIdentifierFeature>()); 139Assert.Null(context.Features.Get<IItemsFeature>()); 142Assert.NotNull(context.Features.Get<IItemsFeature>()); 216context.Features.Set<IHttpResponseFeature>(responseFeature); 243context.Features.Set<IHttpResponseFeature>(responseFeature);
Features\FormFeatureTests.cs (40)
16context.Features.Set<IHttpResponseFeature>(responseFeature); 21context.Features.Set<IFormFeature>(formFeature); 54context.Features.Set<IHttpResponseFeature>(responseFeature); 59context.Features.Set<IFormFeature>(formFeature); 72formFeature = context.Features.Get<IFormFeature>(); 89context.Features.Set<IHttpResponseFeature>(responseFeature); 98context.Features.Set<IRequestBodyPipeFeature>(mockFeature); 101context.Features.Set<IFormFeature>(formFeature); 109formFeature = context.Features.Get<IFormFeature>(); 204context.Features.Set<IHttpResponseFeature>(responseFeature); 209context.Features.Set<IFormFeature>(formFeature); 216formFeature = context.Features.Get<IFormFeature>(); 239context.Features.Set<IHttpResponseFeature>(responseFeature); 244context.Features.Set<IFormFeature>(formFeature); 251formFeature = context.Features.Get<IFormFeature>(); 276context.Features.Set<IHttpResponseFeature>(responseFeature); 281context.Features.Set<IFormFeature>(formFeature); 288formFeature = context.Features.Get<IFormFeature>(); 324context.Features.Set<IHttpResponseFeature>(responseFeature); 329context.Features.Set<IFormFeature>(formFeature); 336formFeature = context.Features.Get<IFormFeature>(); 361context.Features.Set<IHttpResponseFeature>(responseFeature); 366context.Features.Set<IFormFeature>(formFeature); 373formFeature = context.Features.Get<IFormFeature>(); 409context.Features.Set<IHttpResponseFeature>(responseFeature); 414context.Features.Set<IFormFeature>(formFeature); 421formFeature = context.Features.Get<IFormFeature>(); 461context.Features.Set<IHttpResponseFeature>(responseFeature); 466context.Features.Set<IFormFeature>(formFeature); 485context.Features.Set<IHttpResponseFeature>(responseFeature); 490context.Features.Set<IFormFeature>(formFeature); 509context.Features.Set<IHttpResponseFeature>(responseFeature); 514context.Features.Set<IFormFeature>(formFeature); 533context.Features.Set<IHttpResponseFeature>(responseFeature); 538context.Features.Set<IFormFeature>(formFeature); 558context.Features.Set<IHttpResponseFeature>(responseFeature); 563context.Features.Set<IFormFeature>(formFeature); 570formFeature = context.Features.Get<IFormFeature>(); 601context.Features.Set<IHttpResponseFeature>(responseFeature); 606context.Features.Set<IFormFeature>(formFeature);
Internal\DefaultHttpRequestTests.cs (5)
202var routeValuesFeature = context.Features.Get<IRouteValuesFeature>(); 213routeValuesFeature = context.Features.Get<IRouteValuesFeature>(); 233context.Features.Set<IRouteValuesFeature>(customRouteValuesFeature); 238context.Features.Set<IRouteValuesFeature>(null); 349context.Features.Get<IHttpRequestFeature>().Headers = headers;
Internal\DefaultHttpResponseTests.cs (4)
86Assert.Same(responseBodyMock.Object, context.Features.Get<IHttpResponseBodyFeature>()); 91Assert.NotSame(responseBodyMock.Object, context.Features.Get<IHttpResponseBodyFeature>()); 96Assert.Same(responseBodyMock.Object, context.Features.Get<IHttpResponseBodyFeature>()); 241context.Features.Get<IHttpResponseFeature>().Headers = headers;
Microsoft.AspNetCore.HttpLogging.Tests (8)
HttpLoggingMiddlewareTests.cs (8)
1215httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1265httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1319httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1362httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1397httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1440httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1472httpContext.Features.Set<IHttpUpgradeFeature>(upgradeFeatureMock.Object); 1491Assert.False(httpContext.Features.Get<IHttpUpgradeFeature>() is UpgradeFeatureLoggingDecorator);
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (10)
XmlDataContractSerializerInputFormatterTest.cs (5)
148httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 212httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 247httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 279httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 338httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature());
XmlSerializerInputFormatterTest.cs (5)
53httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 90httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 126httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 162httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 204httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature());
Microsoft.AspNetCore.Mvc.IntegrationTests (2)
ModelBindingTestHelper.cs (2)
153httpContext.Features.Set<IHttpRequestLifetimeFeature>(new CancellableRequestLifetimeFeature()); 154httpContext.Features.Set<IHttpRequestBodyDetectionFeature>(new NonZeroContentLengthRequestBodyDetectionFeature(httpContext));
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (7)
NewtonsoftJsonInputFormatterTest.cs (5)
40httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 76httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 112httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 504httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 547httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature());
NewtonsoftJsonPatchInputFormatterTest.cs (2)
39httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature()); 76httpContext.Features.Set<IHttpResponseFeature>(new TestResponseFeature());
Microsoft.AspNetCore.Mvc.RazorPages.Test (1)
Filters\PageViewDataAttributeFilterTest.cs (1)
32var feature = Assert.Single(httpContext.Features, f => f.Key == typeof(IViewDataValuesProviderFeature));
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (13)
CookieTempDataProviderTest.cs (5)
41httpContext.Features.Set<IResponseCookiesFeature>(new FakeResponseCookiesFeature(responseCookies)); 127httpContext.Features.Set<IResponseCookiesFeature>(new FakeResponseCookiesFeature(responseCookies)); 162httpContext.Features.Set<IResponseCookiesFeature>(new FakeResponseCookiesFeature(responseCookies)); 198httpContext.Features.Set<IResponseCookiesFeature>(new FakeResponseCookiesFeature(responseCookies)); 247httpContext.Features.Set<IResponseCookiesFeature>(new FakeResponseCookiesFeature(responseCookies));
Filters\AntiforgeryMiddlewareAuthorizationFilterTest.cs (4)
21httpContext.Features.Set<IAntiforgeryValidationFeature>(new AntiforgeryValidationFeature(false, new AntiforgeryValidationException(string.Empty))); 39httpContext.Features.Set<IAntiforgeryValidationFeature>(new AntiforgeryValidationFeature(true, null)); 56httpContext.Features.Set<IAntiforgeryValidationFeature>(new AntiforgeryValidationFeature(false, new AntiforgeryValidationException(string.Empty))); 73httpContext.Features.Set<IAntiforgeryValidationFeature>(new AntiforgeryValidationFeature(true, null));
Filters\ControllerViewDataAttributeFilterTest.cs (1)
28var feature = Assert.Single(httpContext.Features, f => f.Key == typeof(IViewDataValuesProviderFeature));
Filters\SaveTempDataFilterTest.cs (1)
364httpContext.Features.Set<IHttpResponseFeature>(responseFeature);
SessionStateTempDataProviderTest.cs (1)
83httpContext.Features.Set<ISessionFeature>(new SessionFeature() { Session = new TestSession() });
ViewComponentTests.cs (1)
241httpContext.Features.Set<ISessionFeature>(new SessionFeature() { Session = new TestSession() });
Microsoft.AspNetCore.ResponseCaching.Tests (1)
ResponseCachingMiddlewareTests.cs (1)
919context.Features.Set<IHttpResponseFeature>(new FakeResponseFeature());
Microsoft.AspNetCore.Routing.Tests (5)
Builder\EndpointRoutingApplicationBuilderExtensionsTest.cs (3)
72Assert.Null(httpContext.Features.Get<IEndpointFeature>()); 104var feature = httpContext.Features.Get<IEndpointFeature>(); 168Assert.Null(httpContext.Features.Get<IEndpointFeature>());
EndpointRoutingMiddlewareFormOptionsTest.cs (2)
102var httpContext = httpContextFactory.Create( new DefaultHttpContext().Features); 185var formFeature = httpContext.Features.Get<IFormFeature>();
Microsoft.AspNetCore.Security.Microbenchmarks (1)
AuthorizationMiddlewareBenchmark.cs (1)
31_httpContextHasEndpoint.Features.Set<IEndpointFeature>(feature);
Microsoft.AspNetCore.StaticFiles.Tests (2)
StaticFileContextTest.cs (2)
74httpContext.Features.Set<IHttpsCompressionFeature>(httpsCompressionFeature); 103httpContext.Features.Set<IHttpsCompressionFeature>(httpsCompressionFeature);