1 type derived from HttpContext
Microsoft.AspNetCore.Http (1)
4041 references to HttpContext
Aspire.Dashboard (18)
BasicLinkedApp (1)
BasicWebSite (3)
Binding.Http.IntegrationTests (1)
blazor-devserver (1)
ControllersFromServicesClassLibrary (1)
CookiePolicySample (1)
CorsMiddlewareWebSite (2)
CustomAuthorizationFailureResponse (1)
Diagnostics.EFCore.FunctionalTests (11)
ExceptionHandlerSample (1)
HealthChecksSample (1)
Http2SampleApp (1)
IdentitySample.PasskeyConformance (4)
IIS.Microbenchmarks (1)
InMemory.FunctionalTests (26)
InProcessWebSite (151)
Interop.FunctionalTests (5)
JwtSample (1)
Kestrel.SampleApp (2)
Keycloak.Web (1)
LocalizationSample (1)
Microsoft.Analyzers.Extra.Tests (1)
Microsoft.AspNetCore.Antiforgery (48)
Microsoft.AspNetCore.Antiforgery.Test (39)
DefaultAntiforgeryTest.cs (17)
26var httpContext = GetHttpContext();
49var httpContext = GetHttpContext();
70var httpContext = GetHttpContext();
91var httpContext = GetHttpContext();
112var httpContext = GetHttpContext();
270t => t.SaveCookieToken(It.IsAny<HttpContext>(), It.IsAny<string>()),
303t => t.SaveCookieToken(It.IsAny<HttpContext>(), It.IsAny<string>()),
334t => t.SaveCookieToken(It.IsAny<HttpContext>(), It.IsAny<string>()),
461t => t.SaveCookieToken(It.IsAny<HttpContext>(), context.TestTokenSet.NewCookieTokenString),
495t => t.SaveCookieToken(It.IsAny<HttpContext>(), context.TestTokenSet.NewCookieTokenString),
583t => t.SaveCookieToken(It.IsAny<HttpContext>(), It.IsAny<string>()),
1193t => t.SaveCookieToken(It.IsAny<HttpContext>(), It.IsAny<string>()),
1380HttpContext httpContext,
1409private HttpContext GetHttpContext(IAntiforgeryFeature? antiforgeryFeature = null)
1431HttpContext context,
1487var httpContext = GetHttpContext(antiforgeryFeature);
1560public HttpContext HttpContext { get; set; } = default!;
DefaultAntiforgeryTokenStoreTest.cs (20)
18var httpContext = GetHttpContext();
37var httpContext = GetHttpContext(_cookieName, string.Empty);
57var httpContext = GetHttpContext(_cookieName, expectedToken);
77var httpContext = GetHttpContext();
100var httpContext = GetHttpContext("cookie-name", "cookie-value");
129var httpContext = GetHttpContext("cookie-name", "cookie-value");
158var httpContext = GetHttpContext("cookie-name", "cookie-value");
188var httpContext = GetHttpContext("cookie-name", "cookie-value");
216var httpContext = GetHttpContext("cookie-name", "cookie-value");
244var httpContext = GetHttpContext("cookie-name", "cookie-value");
271var httpContext = GetHttpContext("cookie-name", "cookie-value");
297var httpContext = new Mock<HttpContext>();
322var httpContext = new Mock<HttpContext>();
359var httpContext = new Mock<HttpContext>();
404var httpContext = new Mock<HttpContext>();
440var httpContext = new Mock<HttpContext>();
479var httpContext = new Mock<HttpContext>();
512private HttpContext GetHttpContext(string cookieName, string cookieValue)
514var context = GetHttpContext();
519private HttpContext GetHttpContext()
Microsoft.AspNetCore.AsyncState (6)
Microsoft.AspNetCore.Authentication (24)
Microsoft.AspNetCore.Authentication.Abstractions (74)
AuthenticationHttpContextExtensions.cs (41)
20/// <param name="context">The <see cref="HttpContext"/> context.</param>
22public static Task<AuthenticateResult> AuthenticateAsync(this HttpContext context) =>
28/// <param name="context">The <see cref="HttpContext"/> context.</param>
31public static Task<AuthenticateResult> AuthenticateAsync(this HttpContext context, string? scheme) =>
38/// <param name="context">The <see cref="HttpContext"/> context.</param>
41public static Task ChallengeAsync(this HttpContext context, string? scheme) =>
49/// <param name="context">The <see cref="HttpContext"/> context.</param>
51public static Task ChallengeAsync(this HttpContext context) =>
59/// <param name="context">The <see cref="HttpContext"/> context.</param>
62public static Task ChallengeAsync(this HttpContext context, AuthenticationProperties? properties) =>
69/// <param name="context">The <see cref="HttpContext"/> context.</param>
73public static Task ChallengeAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
80/// <param name="context">The <see cref="HttpContext"/> context.</param>
83public static Task ForbidAsync(this HttpContext context, string? scheme) =>
91/// <param name="context">The <see cref="HttpContext"/> context.</param>
93public static Task ForbidAsync(this HttpContext context) =>
101/// <param name="context">The <see cref="HttpContext"/> context.</param>
104public static Task ForbidAsync(this HttpContext context, AuthenticationProperties? properties) =>
111/// <param name="context">The <see cref="HttpContext"/> context.</param>
115public static Task ForbidAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
121/// <param name="context">The <see cref="HttpContext"/> context.</param>
125public static Task SignInAsync(this HttpContext context, string? scheme, ClaimsPrincipal principal) =>
132/// <param name="context">The <see cref="HttpContext"/> context.</param>
135public static Task SignInAsync(this HttpContext context, ClaimsPrincipal principal) =>
142/// <param name="context">The <see cref="HttpContext"/> context.</param>
146public static Task SignInAsync(this HttpContext context, ClaimsPrincipal principal, AuthenticationProperties? properties) =>
152/// <param name="context">The <see cref="HttpContext"/> context.</param>
157public static Task SignInAsync(this HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties) =>
164/// <param name="context">The <see cref="HttpContext"/> context.</param>
166public static Task SignOutAsync(this HttpContext context) => context.SignOutAsync(scheme: null, properties: null);
172/// <param name="context">The <see cref="HttpContext"/> context.</param>
175public static Task SignOutAsync(this HttpContext context, AuthenticationProperties? properties) => context.SignOutAsync(scheme: null, properties: properties);
180/// <param name="context">The <see cref="HttpContext"/> context.</param>
183public static Task SignOutAsync(this HttpContext context, string? scheme) => context.SignOutAsync(scheme, properties: null);
188/// <param name="context">The <see cref="HttpContext"/> context.</param>
192public static Task SignOutAsync(this HttpContext context, string? scheme, AuthenticationProperties? properties) =>
198/// <param name="context">The <see cref="HttpContext"/> context.</param>
202public static Task<string?> GetTokenAsync(this HttpContext context, string? scheme, string tokenName) =>
209/// <param name="context">The <see cref="HttpContext"/> context.</param>
212public static Task<string?> GetTokenAsync(this HttpContext context, string tokenName) =>
216private static IAuthenticationService GetAuthenticationService(HttpContext context) =>
AuthenticationOptions.cs (5)
69/// Used as the default scheme by <see cref="IAuthenticationService.AuthenticateAsync(HttpContext, string)"/>.
74/// Used as the default scheme by <see cref="IAuthenticationService.SignInAsync(HttpContext, string, System.Security.Claims.ClaimsPrincipal, AuthenticationProperties)"/>.
79/// Used as the default scheme by <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.
84/// Used as the default scheme by <see cref="IAuthenticationService.ChallengeAsync(HttpContext, string, AuthenticationProperties)"/>.
89/// Used as the default scheme by <see cref="IAuthenticationService.ForbidAsync(HttpContext, string, AuthenticationProperties)"/>.
IAuthenticationSchemeProvider.cs (10)
27/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.AuthenticateAsync(HttpContext, string)"/>.
31/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.AuthenticateAsync(HttpContext, string)"/>.</returns>
35/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.ChallengeAsync(HttpContext, string, AuthenticationProperties)"/>.
39/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.ChallengeAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
43/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.ForbidAsync(HttpContext, string, AuthenticationProperties)"/>.
47/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.ForbidAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
51/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.SignInAsync(HttpContext, string, System.Security.Claims.ClaimsPrincipal, AuthenticationProperties)"/>.
55/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.SignInAsync(HttpContext, string, System.Security.Claims.ClaimsPrincipal, AuthenticationProperties)"/>.</returns>
59/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.
63/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
IAuthenticationService.cs (10)
17/// <param name="context">The <see cref="HttpContext"/>.</param>
20Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string? scheme);
26/// <param name="context">The <see cref="HttpContext"/>.</param>
30Task ChallengeAsync(HttpContext context, string? scheme, AuthenticationProperties? properties);
36/// <param name="context">The <see cref="HttpContext"/>.</param>
40Task ForbidAsync(HttpContext context, string? scheme, AuthenticationProperties? properties);
45/// <param name="context">The <see cref="HttpContext"/>.</param>
50Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties);
55/// <param name="context">The <see cref="HttpContext"/>.</param>
59Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties);
Microsoft.AspNetCore.Authentication.BearerToken (6)
Microsoft.AspNetCore.Authentication.Certificate (9)
Microsoft.AspNetCore.Authentication.Cookies (20)
ITicketStore.cs (7)
34/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
37Task<string> StoreAsync(AuthenticationTicket ticket, HttpContext httpContext, CancellationToken cancellationToken) => StoreAsync(ticket, cancellationToken);
64Task RenewAsync(string key, AuthenticationTicket ticket, HttpContext httpContext, CancellationToken cancellationToken) => RenewAsync(key, ticket, cancellationToken);
85/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
88Task<AuthenticationTicket?> RetrieveAsync(string key, HttpContext httpContext, CancellationToken cancellationToken) => RetrieveAsync(key, cancellationToken);
109/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param>
112Task RemoveAsync(string key, HttpContext httpContext, CancellationToken cancellationToken) => RemoveAsync(key, cancellationToken);
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (4)
90public string? GetRequestCookie(HttpContext context, string key)
145public void AppendResponseCookie(HttpContext context, string key, string? value, CookieOptions options)
224public void DeleteCookie(HttpContext context, string key, CookieOptions options)
312private static void DeleteChunks(HttpContext context, IRequestCookieCollection requestCookies, CookieOptions options, string key, int startChunk, int endChunk)
Microsoft.AspNetCore.Authentication.Core (26)
AuthenticationSchemeProvider.cs (10)
63/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.AuthenticateAsync(HttpContext, string)"/>.
67/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.AuthenticateAsync(HttpContext, string)"/>.</returns>
74/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.ChallengeAsync(HttpContext, string, AuthenticationProperties)"/>.
78/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.ChallengeAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
85/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.ForbidAsync(HttpContext, string, AuthenticationProperties)"/>.
89/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.ForbidAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
96/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.SignInAsync(HttpContext, string, System.Security.Claims.ClaimsPrincipal, AuthenticationProperties)"/>.
100/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.SignInAsync(HttpContext, string, System.Security.Claims.ClaimsPrincipal, AuthenticationProperties)"/>.</returns>
107/// Returns the scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.
111/// <returns>The scheme that will be used by default for <see cref="IAuthenticationService.SignOutAsync(HttpContext, string, AuthenticationProperties)"/>.</returns>
AuthenticationService.cs (10)
60/// <param name="context">The <see cref="HttpContext"/>.</param>
63public virtual async Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string? scheme)
104/// <param name="context">The <see cref="HttpContext"/>.</param>
108public virtual async Task ChallengeAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
127/// <param name="context">The <see cref="HttpContext"/>.</param>
131public virtual async Task ForbidAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
150/// <param name="context">The <see cref="HttpContext"/>.</param>
155public virtual async Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties)
193/// <param name="context">The <see cref="HttpContext"/>.</param>
197public virtual async Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
AuthenticationServiceImpl.cs (5)
19public override async Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string? scheme)
37public override async Task ChallengeAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
52public override async Task ForbidAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
67public override async Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties)
82public override async Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
Microsoft.AspNetCore.Authentication.Core.Test (7)
Microsoft.AspNetCore.Authentication.JwtBearer (5)
Microsoft.AspNetCore.Authentication.Negotiate (4)
Microsoft.AspNetCore.Authentication.Negotiate.Test (31)
EventTests.cs (14)
40var result = await SendAsync(server, "/Authenticate", new TestConnection());
64var result = await SendAsync(server, "/Authenticate", new TestConnection());
112var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate InvalidBlob");
162var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate OtherError");
187var response = await SendAsync(server, "/418", new TestConnection(), "Negotiate CredentialError");
212var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate CredentialError");
237var response = await SendAsync(server, "/404", new TestConnection(), "Negotiate ClientError");
262var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate ClientError");
292var result = await SendAsync(server, "/Authenticate", testConnection);
338var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob");
362var result = await SendAsync(server, "/Authenticate", new TestConnection(), "Negotiate ClientKerberosBlob");
397var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob1");
404var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob2");
457private static Task<HttpContext> SendAsync(TestServer server, string path, TestConnection connection, string authorizationHeader = null)
NegotiateHandlerTests.cs (17)
46var result = await SendAsync(server, "/Anonymous1", new TestConnection());
56var result = await SendAsync(server, "/Anonymous2", connection: null, http2: true);
66var result = await SendAsync(server, "/Authenticate", new TestConnection());
77var result = await SendAsync(server, "/Authenticate", connection: null, http2: true);
88var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob1");
170var result = await SendAsync(server, "/Authenticate", testConnection);
197var result = await SendAsync(server, "/Authenticate", testConnection);
295var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientNtlmBlob2");
306var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate CredentialError");
317var result = await SendAsync(server, "/404", testConnection, "Negotiate ClientError");
334var result = await SendAsync(server, "/AuthenticateAndRetrieveRBACClaims", testConnection, "Negotiate ClientKerberosBlob");
342var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob");
355var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob1");
362var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob2");
375var result = await SendAsync(server, "/404", testConnection, "Negotiate ClientNtlmBlob1");
382var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientNtlmBlob2");
487private static Task<HttpContext> SendAsync(TestServer server, string path, TestConnection connection, string authorizationHeader = null, bool http2 = false)
Microsoft.AspNetCore.Authentication.OAuth (1)
Microsoft.AspNetCore.Authentication.OpenIdConnect (10)
Microsoft.AspNetCore.Authentication.Test (35)
Microsoft.AspNetCore.Authentication.Twitter (2)
Microsoft.AspNetCore.Authentication.WsFederation (6)
Microsoft.AspNetCore.Authorization.Policy (19)
Microsoft.AspNetCore.Authorization.Test (71)
AuthorizationMiddlewareTests.cs (45)
33var context = GetHttpContext(anonymous: true);
53var context = GetHttpContext(anonymous: true);
72var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint());
93var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint());
115var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
136var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
158var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute() { AuthenticationSchemes = "whatever" }), authenticationService: authenticationService);
180var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
205var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute("whatever")));
255var context = GetHttpContext(anonymous: true, endpoint: endpoint);
305var context = GetHttpContext(anonymous: true, endpoint: endpoint);
365var context = GetHttpContext(anonymous: true, endpoint: endpoint);
399var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute("whatever")));
433var context = GetHttpContext(anonymous: false, endpoint: CreateEndpoint(new AuthorizeAttribute(), policy));
471var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new ReqAttribute(req)));
493var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new ReqAttribute(req, req2)));
513var context = GetHttpContext(anonymous: false, endpoint: CreateEndpoint(new AuthorizeAttribute(), new ReqAttribute(req)));
535var context = GetHttpContext(anonymous: anonymous, endpoint: CreateEndpoint(new ReqAuthorizeAttribute(req)));
553var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
573var context = GetHttpContext(anonymous: true, endpoint: CreateEndpoint(new AuthorizeAttribute(), new AllowAnonymousAttribute()), authenticationService: authenticationService);
594var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
616var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
638var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
651HttpContext resource = null;
654resource = c.Resource as HttpContext;
663var context = GetHttpContext(endpoint: endpoint);
692var context = GetHttpContext(endpoint: endpoint);
712var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
734var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
757var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService);
778var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
802var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute(), new AllowAnonymousAttribute()), authenticationService: authenticationService);
826authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), "Basic"))
827.ReturnsAsync((HttpContext c, string scheme) =>
833authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), "Bearer"))
834.ReturnsAsync((HttpContext c, string scheme) =>
842var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService.Object);
865var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
891var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
922authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), "Bearer"))
923.ReturnsAsync((HttpContext c, string scheme) =>
930var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()), authenticationService: authenticationService.Object);
956var context = GetHttpContext(endpoint: CreateEndpoint(new AuthorizeAttribute()));
1006private HttpContext GetHttpContext(
1078public Task Invoke(HttpContext context)
PolicyEvaluatorTests.cs (10)
189public Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string scheme)
192public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
195public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
198public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
201public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
209public Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string scheme)
215public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
218public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
221public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
224public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
TestObjects\TestAuthenticationService.cs (5)
20public Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string scheme)
33public Task ChallengeAsync(HttpContext context, string scheme, AuthenticationProperties properties)
39public Task ForbidAsync(HttpContext context, string scheme, AuthenticationProperties properties)
45public Task SignInAsync(HttpContext context, string scheme, ClaimsPrincipal principal, AuthenticationProperties properties)
50public Task SignOutAsync(HttpContext context, string scheme, AuthenticationProperties properties)
Microsoft.AspNetCore.Components.Endpoints (63)
Rendering\EndpointHtmlRenderer.Streaming.cs (8)
27public void InitializeStreamingRenderingFraming(HttpContext httpContext, bool isErrorHandler, bool isReExecuted)
45public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilTaskCompleted, TextWriter writer)
96internal void EmitInitializersIfNecessary(HttpContext httpContext, TextWriter writer)
206internal static bool ShouldShowDetailedErrors(HttpContext httpContext)
214private static void HandleExceptionAfterResponseStarted(HttpContext httpContext, TextWriter writer, Exception exception)
228private static void HandleNotFoundAfterResponseStarted(TextWriter writer, HttpContext httpContext, string notFoundUrl)
234private static void HandleNavigationAfterResponseStarted(TextWriter writer, HttpContext httpContext, string destinationUrl)
241private static void WriteResponseTemplate(TextWriter writer, HttpContext httpContext, string destinationUrl, bool useEnhancedNav)
Microsoft.AspNetCore.Components.Endpoints.Tests (42)
Microsoft.AspNetCore.Components.Server (6)
Microsoft.AspNetCore.Components.WebAssembly.Server (8)
Microsoft.AspNetCore.ConcurrencyLimiter (2)
Microsoft.AspNetCore.ConcurrencyLimiter.Microbenchmarks (5)
Microsoft.AspNetCore.CookiePolicy (13)
Microsoft.AspNetCore.CookiePolicy.Test (40)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (4)
90public string? GetRequestCookie(HttpContext context, string key)
145public void AppendResponseCookie(HttpContext context, string key, string? value, CookieOptions options)
224public void DeleteCookie(HttpContext context, string key, CookieOptions options)
312private static void DeleteChunks(HttpContext context, IRequestCookieCollection requestCookies, CookieOptions options, string key, int startChunk, int endChunk)
Microsoft.AspNetCore.Cors (16)
Microsoft.AspNetCore.Cors.Test (57)
CorsMiddlewareTests.cs (25)
381mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
399o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
410mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
430o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
648mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
688mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
707o => o.GetPolicyAsync(It.IsAny<HttpContext>(), "DefaultPolicyName"),
718mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
737o => o.GetPolicyAsync(It.IsAny<HttpContext>(), "MetadataPolicyName"),
798Mock.Get(policyProvider).Verify(v => v.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()), Times.Never());
799Mock.Get(corsService).Verify(v => v.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()), Times.Never());
810mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
829o => o.GetPolicyAsync(It.IsAny<HttpContext>(), "MetadataPolicyName"),
842mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
845mockCorsService.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()))
864o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
867o => o.EvaluatePolicy(It.IsAny<HttpContext>(), metadataPolicy),
879mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
882mockCorsService.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()))
901o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
904o => o.EvaluatePolicy(It.IsAny<HttpContext>(), policy),
915mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
934o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
945mockProvider.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()))
964o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>()),
CorsServiceTests.cs (32)
18var requestContext = GetHttpContext("POST", origin: null);
37var requestContext = GetHttpContext("GET", origin: null);
52var requestContext = GetHttpContext(origin: "http://example.com");
68var requestContext = GetHttpContext(origin: "http://example.com");
83var requestContext = GetHttpContext(origin: "http://example.com");
102var requestContext = GetHttpContext(origin: "http://example.com");
123var requestContext = GetHttpContext(origin: "http://example.com");
139var requestContext = GetHttpContext(origin: "http://example.com");
158var requestContext = GetHttpContext(origin: "http://example.com");
177var requestContext = GetHttpContext(origin: "http://example.com");
194var requestContext = GetHttpContext(origin: "http://example.com");
211var requestContext = GetHttpContext(origin: "http://example.com");
229var requestContext = GetHttpContext(origin: "http://example.com");
246var requestContext = GetHttpContext(origin: "http://example.com");
262var requestContext = GetHttpContext(origin: "http://example.com");
279var requestContext = GetHttpContext(origin: "http://example.com");
298var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
315var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
335var requestContext = GetHttpContext(
356var requestContext = GetHttpContext(
378var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
398var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
418var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
438var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "GET");
457var requestContext = GetHttpContext(
478var requestContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
497var requestContext = GetHttpContext(
520var requestContext = GetHttpContext(
544var httpContext = GetHttpContext(method: "OPTIONS", origin: "http://example.com", accessControlRequestMethod: "PUT");
907var requestContext = GetHttpContext(origin: "http://example.com");
925var requestContext = GetHttpContext(origin: "http://example.com");
943private static HttpContext GetHttpContext(
Microsoft.AspNetCore.Diagnostics (34)
Microsoft.AspNetCore.Diagnostics.Abstractions (2)
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (9)
Microsoft.AspNetCore.Diagnostics.HealthChecks (4)
Microsoft.AspNetCore.Diagnostics.Middleware (16)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (28)
Microsoft.AspNetCore.Diagnostics.Tests (15)
Microsoft.AspNetCore.Grpc.JsonTranscoding (22)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (2)
Microsoft.AspNetCore.HeaderParsing (2)
Microsoft.AspNetCore.HeaderParsing.Tests (7)
Microsoft.AspNetCore.HeaderPropagation (7)
Microsoft.AspNetCore.HeaderPropagation.Tests (2)
Microsoft.AspNetCore.HostFiltering (4)
Microsoft.AspNetCore.Hosting (47)
Internal\HostingApplicationDiagnostics.cs (30)
70public void BeginRequest(HttpContext httpContext, HostingApplication.Context context)
154public void RequestEnd(HttpContext httpContext, Exception? exception, HostingApplication.Context context)
321private void RecordBeginRequestDiagnostics(HttpContext httpContext, long startTimestamp)
330private void RecordEndRequestDiagnostics(HttpContext httpContext, long currentTimestamp)
339private void RecordUnhandledExceptionDiagnostics(HttpContext httpContext, long currentTimestamp, Exception exception)
350[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))]
351[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))]
355internal DeprecatedRequestData(HttpContext httpContext, long timestamp)
362public HttpContext httpContext { get; }
371[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))]
372[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))]
376internal UnhandledExceptionData(HttpContext httpContext, long timestamp, Exception exception)
384public HttpContext httpContext { get; }
392private void RecordRequestStartEventLog(HttpContext httpContext)
398private void RecordRequestStartMetrics(HttpContext httpContext)
404private Activity? StartActivity(HttpContext httpContext, bool diagnosticsOrLoggingEnabled, out bool hasDiagnosticListener)
452private static TagList CreateInitializeActivityTags(HttpContext httpContext)
494private void StopActivity(HttpContext httpContext, Activity activity, bool hasDiagnosticListener)
509[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))]
522private Activity StartActivity(Activity activity, HttpContext httpContext)
531[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))]
536private void StopActivity(Activity activity, HttpContext httpContext)
550public static IDisposable? RequestScope(ILogger logger, HttpContext httpContext)
581public HostingLogScope(HttpContext httpContext)
Microsoft.AspNetCore.Hosting.Tests (13)
Microsoft.AspNetCore.Http (18)
Microsoft.AspNetCore.Http.Abstractions (91)
EndpointFilterInvocationContext.cs (10)
15public abstract HttpContext HttpContext { get; }
36public static EndpointFilterInvocationContext Create(HttpContext httpContext) =>
43public static EndpointFilterInvocationContext Create<T>(HttpContext httpContext, T arg) =>
50public static EndpointFilterInvocationContext Create<T1, T2>(HttpContext httpContext, T1 arg1, T2 arg2) =>
57public static EndpointFilterInvocationContext Create<T1, T2, T3>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3) =>
64public static EndpointFilterInvocationContext Create<T1, T2, T3, T4>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4) =>
71public static EndpointFilterInvocationContext Create<T1, T2, T3, T4, T5>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) =>
78public static EndpointFilterInvocationContext Create<T1, T2, T3, T4, T5, T6>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) =>
85public static EndpointFilterInvocationContext Create<T1, T2, T3, T4, T5, T6, T7>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) =>
92public static EndpointFilterInvocationContext Create<T1, T2, T3, T4, T5, T6, T7, T8>(HttpContext httpContext, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) =>
EndpointFilterInvocationContextOfT.Generated.cs (20)
14internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0)
40public override HttpContext HttpContext { get; }
136internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1)
167public override HttpContext HttpContext { get; }
265internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2)
301public override HttpContext HttpContext { get; }
401internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
442public override HttpContext HttpContext { get; }
544internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4)
590public override HttpContext HttpContext { get; }
694internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5)
745public override HttpContext HttpContext { get; }
851internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6)
907public override HttpContext HttpContext { get; }
1015internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7)
1076public override HttpContext HttpContext { get; }
1186internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8)
1252public override HttpContext HttpContext { get; }
1364internal EndpointFilterInvocationContext(HttpContext httpContext, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9)
1435public override HttpContext HttpContext { get; }
Extensions\UseMiddlewareExtensions.cs (6)
93if (parameters.Length == 0 || parameters[0].ParameterType != typeof(HttpContext))
95throw new InvalidOperationException(Resources.FormatException_UseMiddlewareNoParameters(InvokeMethodName, InvokeAsyncMethodName, nameof(HttpContext)));
200private static Func<T, HttpContext, IServiceProvider, Task> ReflectionFallback<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
265private static Func<T, HttpContext, IServiceProvider, Task> CompileExpression<T>(MethodInfo methodInfo, ParameterInfo[] parameters)
297var httpContextArg = Expression.Parameter(typeof(HttpContext), "httpContext");
323var lambda = Expression.Lambda<Func<T, HttpContext, IServiceProvider, Task>>(body, instanceArg, httpContextArg, providerArg);
Microsoft.AspNetCore.Http.Abstractions.Tests (52)
UseMiddlewareTest.cs (14)
22nameof(HttpContext)),
36nameof(HttpContext)),
284public async Task InvokeAsync(HttpContext context, RequestDelegate next)
389public Task Invoke(HttpContext context, ref IServiceProvider? sp1, out IServiceProvider? sp2)
401public Task Invoke(HttpContext context, object value) => Task.CompletedTask;
408public Task Invoke(HttpContext context, IServiceProvider provider) => Task.CompletedTask;
415public Task Invoke(HttpContext context, [FromKeyedServices("test")] IKeyedServiceProvider provider) => Task.CompletedTask;
422public Task Invoke(HttpContext context) => Task.CompletedTask;
462public Task Invoke(HttpContext context) => Task.CompletedTask;
464public Task Invoke(HttpContext context, int i) => Task.CompletedTask;
471public Task InvokeAsync(HttpContext context) => Task.CompletedTask;
473public Task InvokeAsync(HttpContext context, int i) => Task.CompletedTask;
480public Task Invoke(HttpContext context) => Task.CompletedTask;
482public Task InvokeAsync(HttpContext context) => Task.CompletedTask;
Microsoft.AspNetCore.Http.Connections (32)
Internal\HttpConnectionDispatcher.cs (16)
61public async Task ExecuteAsync(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionDelegate connectionDelegate)
102public async Task ExecuteNegotiateAsync(HttpContext context, HttpConnectionDispatcherOptions options)
121private async Task ExecuteAsync(HttpContext context, ConnectionDelegate connectionDelegate, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
336private async Task ProcessNegotiate(HttpContext context, HttpConnectionDispatcherOptions options, ConnectionLogScope logScope)
406private static void WriteNegotiatePayload(IBufferWriter<byte> writer, string? connectionId, string? connectionToken, HttpContext context, HttpConnectionDispatcherOptions options,
447private static StringValues GetConnectionToken(HttpContext context) => context.Request.Query["id"];
449private async Task ProcessSend(HttpContext context)
542private async Task ProcessDeleteAsync(HttpContext context)
570private async Task<bool> EnsureConnectionStateAsync(HttpConnectionContext connection, HttpContext context, HttpTransportType transportType, HttpTransportType supportedTransports, ConnectionLogScope logScope)
614var existing = connection.HttpContext;
662private static void UpdateExpiration(HttpConnectionContext connection, HttpContext context)
673private static void CloneUser(HttpContext newContext, HttpContext oldContext)
709private static void CloneHttpContext(HttpContext context, HttpConnectionContext connection)
773private async Task<HttpConnectionContext?> GetConnectionAsync(HttpContext context)
800private async Task<HttpConnectionContext?> GetOrCreateConnectionAsync(HttpContext context, HttpConnectionDispatcherOptions options)
Microsoft.AspNetCore.Http.Connections.Tests (6)
Microsoft.AspNetCore.Http.Extensions (82)
RequestDelegateFactory.cs (70)
77private static readonly MethodInfo LogParameterBindingFailedMethod = GetMethodInfo<Action<HttpContext, string, string, string, bool>>((httpContext, parameterType, parameterName, sourceValue, shouldThrow) =>
79private static readonly MethodInfo LogRequiredParameterNotProvidedMethod = GetMethodInfo<Action<HttpContext, string, string, string, bool>>((httpContext, parameterType, parameterName, source, shouldThrow) =>
81private static readonly MethodInfo LogImplicitBodyNotProvidedMethod = GetMethodInfo<Action<HttpContext, string, bool>>((httpContext, parameterName, shouldThrow) =>
83private static readonly MethodInfo LogFormMappingFailedMethod = GetMethodInfo<Action<HttpContext, string, string, FormDataMappingException, bool>>((httpContext, parameterName, parameterType, exception, shouldThrow) =>
92private static readonly MemberExpression RequestServicesExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.RequestServices))!);
93private static readonly MemberExpression HttpRequestExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Request))!);
94private static readonly MemberExpression HttpResponseExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!);
95private static readonly MemberExpression RequestAbortedExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.RequestAborted))!);
96private static readonly MemberExpression UserExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.User))!);
112private static readonly ConstructorInfo DefaultEndpointFilterInvocationContextConstructor = typeof(DefaultEndpointFilterInvocationContext).GetConstructor(new[] { typeof(HttpContext), typeof(object[]) })!;
118private static readonly MemberExpression FilterContextHttpContextResponseExpr = Expression.Property(FilterContextHttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!);
189Expression<Func<HttpContext, object?>> targetFactory = (httpContext) => handler.Target;
210public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory, RequestDelegateFactoryOptions? options)
229public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory = null, RequestDelegateFactoryOptions? options = null, RequestDelegateMetadataResult? metadataResult = null)
314private static Func<object?, HttpContext, Task>? CreateTargetableRequestDelegate(
318Expression<Func<HttpContext, object?>>? targetFactory = null)
421private static EndpointFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, RequestDelegateFactoryContext factoryContext, Expression<Func<HttpContext, object?>>? targetFactory)
835else if (parameter.ParameterType == typeof(HttpContext))
1263private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegate(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1270var continuation = Expression.Lambda<Func<object?, HttpContext, object?[], Task>>(
1290return Expression.Lambda<Func<object?, HttpContext, Task>>(
1304private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForJson(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext)
1318var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1355var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
1379HttpContext httpContext,
1437private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForForm(
1453var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>(
1487var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>(
1508HttpContext httpContext,
2031var bindAsyncDelegate = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(bindAsyncMethod.Expression, HttpContextExpr).Compile();
2435private static Task ExecuteValueTaskOfObject(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2437static async Task ExecuteAwaited(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2450private static Task ExecuteTaskOfObject(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2452static async Task ExecuteAwaited(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2465private static Task ExecuteAwaitedReturn(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo)
2470private static Task ExecuteTaskOfTFast<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2474static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2487private static Task ExecuteTaskOfT<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2491static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2504private static Task ExecuteTaskOfString(Task<string?> task, HttpContext httpContext)
2509static async Task ExecuteAwaited(Task<string> task, HttpContext httpContext)
2522private static Task ExecuteWriteStringResponseAsync(HttpContext httpContext, string text)
2577private static Task ExecuteValueTaskOfTFast<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2579static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2592private static Task ExecuteValueTaskOfT<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2594static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo)
2607private static Task ExecuteValueTaskOfString(ValueTask<string?> task, HttpContext httpContext)
2611static async Task ExecuteAwaited(ValueTask<string> task, HttpContext httpContext)
2624private static Task ExecuteValueTaskResult<T>(ValueTask<T?> task, HttpContext httpContext) where T : IResult
2626static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext)
2639private static async Task ExecuteTaskResult<T>(Task<T?> task, HttpContext httpContext) where T : IResult
2646private static async Task ExecuteResultWriteResponse(IResult? result, HttpContext httpContext)
2690public static void RequestBodyIOException(HttpContext httpContext, IOException exception)
2696public static void InvalidJsonRequestBody(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow)
2710public static void ParameterBindingFailed(HttpContext httpContext, string parameterTypeName, string parameterName, string sourceValue, bool shouldThrow)
2724public static void RequiredParameterNotProvided(HttpContext httpContext, string parameterTypeName, string parameterName, string source, bool shouldThrow)
2738public static void ImplicitBodyNotProvided(HttpContext httpContext, string parameterName, bool shouldThrow)
2752public static void UnexpectedJsonContentType(HttpContext httpContext, string? contentType, bool shouldThrow)
2766public static void UnexpectedNonFormContentType(HttpContext httpContext, string? contentType, bool shouldThrow)
2780public static void InvalidFormRequestBody(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow)
2794public static void InvalidAntiforgeryToken(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow)
2808public static void FormDataMappingFailed(HttpContext httpContext, string parameterTypeName, string parameterName, FormDataMappingException exception, bool shouldThrow)
2822public static void UnexpectedRequestWithoutBody(HttpContext httpContext, string parameterTypeName, string parameterName, bool shouldThrow)
2836private static ILogger GetLogger(HttpContext httpContext)
Microsoft.AspNetCore.Http.Extensions.Tests (568)
ParameterBindingMethodCacheTests.cs (32)
231var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(
262var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(
388var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(methodFound.Expression!,
406var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(methodFound.Expression!,
424var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
440var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
456var parseHttpContext = Expression.Lambda<Func<HttpContext, ValueTask<object>>>(methodFound.Expression!,
1077public static ValueTask<BindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter)
1093public static ValueTask<BindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
1109public static ValueTask<NullableReturningBindAsyncStruct?> BindAsync(HttpContext context, ParameterInfo parameter) =>
1115public static ValueTask<BindAsyncSingleArgRecord?> BindAsync(HttpContext context)
1128public static ValueTask<BindAsyncSingleArgStruct> BindAsync(HttpContext context)
1141public static Task<InvalidWrongReturnBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter) =>
1147public static Task<InvalidWrongReturnBindAsyncClass> BindAsync(HttpContext context, ParameterInfo parameter) =>
1165public static ValueTask<BindAsyncStructWithGoodAndBad> BindAsync(HttpContext context, ParameterInfo parameter) =>
1174public static ValueTask<BindAsyncClassWithGoodAndBad> BindAsync(HttpContext context, ParameterInfo parameter) =>
1183public static ValueTask<T?> BindAsync(HttpContext context)
1200public static ValueTask<T?> BindAsync(HttpContext context, ParameterInfo parameter)
1217static ValueTask<T?> BindAsync(HttpContext context)
1225static ValueTask<T?> BindAsync(HttpContext context)
1245static ValueTask<BindAsyncFromInterface?> BindAsync(HttpContext context)
1270static ValueTask<T?> BindAsync(HttpContext context, ParameterInfo parameter)
1282public static void BindAsync(HttpContext context, ParameterInfo parameter)
1285public static ValueTask<BindAsyncFallsBack?> BindAsync(HttpContext context)
1293public static void BindAsync(HttpContext context, ParameterInfo parameter)
1299public static void BindAsync(HttpContext context, ParameterInfo parameter)
1302public static void BindAsync(HttpContext context)
1467public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter)
1475static ValueTask<BindAsyncFromExplicitStaticAbstractInterface?> IBindableFromHttpContext<BindAsyncFromExplicitStaticAbstractInterface>.BindAsync(HttpContext context, ParameterInfo parameter)
1491public static ValueTask<BindAsyncFromStaticAbstractInterfaceAndBindAsync?> BindAsync(HttpContext context, ParameterInfo parameter)
1497public static ValueTask<BindAsyncFromStaticAbstractInterfaceAndBindAsync?> BindAsync(HttpContext context)
1505public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter)
RequestDelegateFactoryTests.cs (171)
49void TestAction(HttpContext httpContext)
54Task TaskTestAction(HttpContext httpContext)
60ValueTask ValueTaskTestAction(HttpContext httpContext)
66void StaticTestAction(HttpContext httpContext)
71Task StaticTaskTestAction(HttpContext httpContext)
77ValueTask StaticValueTaskTestAction(HttpContext httpContext)
83void MarkAsInvoked(HttpContext httpContext)
90new object[] { (Action<HttpContext>)TestAction },
91new object[] { (Func<HttpContext, Task>)TaskTestAction },
92new object[] { (Func<HttpContext, ValueTask>)ValueTaskTestAction },
93new object[] { (Action<HttpContext>)StaticTestAction },
94new object[] { (Func<HttpContext, Task>)StaticTaskTestAction },
95new object[] { (Func<HttpContext, ValueTask>)StaticValueTaskTestAction },
125private static void StaticTestActionBasicReflection(HttpContext httpContext)
136new[] { typeof(HttpContext) });
157public void NonStaticTestAction(HttpContext httpContext)
169new[] { typeof(HttpContext) });
206new[] { typeof(HttpContext) });
217private static void TestOptional(HttpContext httpContext, [FromRoute] int value = 42)
222private static void TestOptionalNullable(HttpContext httpContext, int? value = 42)
227private static void TestOptionalNullableNull(HttpContext httpContext, double? value = null)
232private static void TestOptionalString(HttpContext httpContext, string value = "default")
242var factoryResult = RequestDelegateFactory.Create((int? id, HttpContext httpContext) =>
300static void Store<T>(HttpContext httpContext, T tryParsable)
310new object[] { (Action<HttpContext, string[]>)Store, new[] { "plain string" }, new[] { "plain string" } },
311new object[] { (Action<HttpContext, StringValues>)Store, new[] { "1", "2", "3" }, new StringValues(new[] { "1", "2", "3" }) },
312new object[] { (Action<HttpContext, int[]>)Store, new[] { "-1", "2", "3" }, new[] { -1,2,3 } },
313new object[] { (Action<HttpContext, uint[]>)Store, new[] { "1","42","32"}, new[] { 1U, 42U, 32U } },
314new object[] { (Action<HttpContext, bool[]>)Store, new[] { "true", "false" }, new[] { true, false } },
315new object[] { (Action<HttpContext, short[]>)Store, new[] { "-42" }, new[] { (short)-42 } },
316new object[] { (Action<HttpContext, ushort[]>)Store, new[] { "42" }, new[] { (ushort)42 } },
317new object[] { (Action<HttpContext, long[]>)Store, new[] { "-42" }, new[] { -42L } },
318new object[] { (Action<HttpContext, ulong[]>)Store, new[] { "42" }, new[] { 42UL } },
319new object[] { (Action<HttpContext, IntPtr[]>)Store, new[] { "-42" },new[] { new IntPtr(-42) } },
320new object[] { (Action<HttpContext, char[]>)Store, new[] { "A" }, new[] { 'A' } },
321new object[] { (Action<HttpContext, double[]>)Store, new[] { "0.5" },new[] { 0.5 } },
322new object[] { (Action<HttpContext, float[]>)Store, new[] { "0.5" },new[] { 0.5f } },
323new object[] { (Action<HttpContext, Half[]>)Store, new[] { "0.5" }, new[] { (Half)0.5f } },
324new object[] { (Action<HttpContext, decimal[]>)Store, new[] { "0.5" },new[] { 0.5m } },
325new object[] { (Action<HttpContext, Uri[]>)Store, new[] { "https://example.org" }, new[] { new Uri("https://example.org") } },
326new object[] { (Action<HttpContext, DateTime[]>)Store, new[] { now.ToString("o") },new[] { now.ToUniversalTime() } },
327new object[] { (Action<HttpContext, DateTimeOffset[]>)Store, new[] { "1970-01-01T00:00:00.0000000+00:00" },new[] { DateTimeOffset.UnixEpoch } },
328new object[] { (Action<HttpContext, TimeSpan[]>)Store, new[] { "00:00:42" },new[] { TimeSpan.FromSeconds(42) } },
329new object[] { (Action<HttpContext, Guid[]>)Store, new[] { "00000000-0000-0000-0000-000000000000" },new[] { Guid.Empty } },
330new object[] { (Action<HttpContext, Version[]>)Store, new[] { "6.0.0.42" }, new[] { new Version("6.0.0.42") } },
331new object[] { (Action<HttpContext, BigInteger[]>)Store, new[] { "-42" },new[]{ new BigInteger(-42) } },
332new object[] { (Action<HttpContext, IPAddress[]>)Store, new[] { "127.0.0.1" }, new[] { IPAddress.Loopback } },
333new object[] { (Action<HttpContext, IPEndPoint[]>)Store, new[] { "127.0.0.1:80" },new[] { new IPEndPoint(IPAddress.Loopback, 80) } },
334new object[] { (Action<HttpContext, AddressFamily[]>)Store, new[] { "Unix" },new[] { AddressFamily.Unix } },
335new object[] { (Action<HttpContext, ILOpCode[]>)Store, new[] { "Nop" }, new[] { ILOpCode.Nop } },
336new object[] { (Action<HttpContext, AssemblyFlags[]>)Store, new[] { "PublicKey,Retargetable" },new[] { AssemblyFlags.PublicKey | AssemblyFlags.Retargetable } },
337new object[] { (Action<HttpContext, int?[]>)Store, new[] { "42" }, new int?[] { 42 } },
338new object[] { (Action<HttpContext, MyEnum[]>)Store, new[] { "ValueB" },new[] { MyEnum.ValueB } },
339new object[] { (Action<HttpContext, MyTryParseRecord[]>)Store, new[] { "https://example.org" },new[] { new MyTryParseRecord(new Uri("https://example.org")) } },
340new object?[] { (Action<HttpContext, int[]>)Store, new string[] {}, Array.Empty<int>() },
341new object?[] { (Action<HttpContext, int?[]>)Store, new string?[] { "1", "2", null, "4" }, new int?[] { 1,2, null, 4 } },
342new object?[] { (Action<HttpContext, int?[]>)Store, new string[] { "1", "2", "", "4" }, new int?[] { 1,2, null, 4 } },
343new object[] { (Action<HttpContext, MyTryParseRecord?[]?>)Store, new[] { "" }, new MyTryParseRecord?[] { null } },
352static void Store<T>(HttpContext httpContext, T tryParsable)
362new object[] { (Action<HttpContext, string>)Store, "plain string", "plain string" },
363new object[] { (Action<HttpContext, int>)Store, "-42", -42 },
364new object[] { (Action<HttpContext, uint>)Store, "42", 42U },
365new object[] { (Action<HttpContext, bool>)Store, "true", true },
366new object[] { (Action<HttpContext, short>)Store, "-42", (short)-42 },
367new object[] { (Action<HttpContext, ushort>)Store, "42", (ushort)42 },
368new object[] { (Action<HttpContext, long>)Store, "-42", -42L },
369new object[] { (Action<HttpContext, ulong>)Store, "42", 42UL },
370new object[] { (Action<HttpContext, IntPtr>)Store, "-42", new IntPtr(-42) },
371new object[] { (Action<HttpContext, char>)Store, "A", 'A' },
372new object[] { (Action<HttpContext, double>)Store, "0.5", 0.5 },
373new object[] { (Action<HttpContext, float>)Store, "0.5", 0.5f },
374new object[] { (Action<HttpContext, Half>)Store, "0.5", (Half)0.5f },
375new object[] { (Action<HttpContext, decimal>)Store, "0.5", 0.5m },
376new object[] { (Action<HttpContext, Uri>)Store, "https://example.org", new Uri("https://example.org") },
377new object[] { (Action<HttpContext, DateTime>)Store, now.ToString("o"), now.ToUniversalTime() },
378new object[] { (Action<HttpContext, DateTimeOffset>)Store, "1970-01-01T00:00:00.0000000+00:00", DateTimeOffset.UnixEpoch },
379new object[] { (Action<HttpContext, TimeSpan>)Store, "00:00:42", TimeSpan.FromSeconds(42) },
380new object[] { (Action<HttpContext, Guid>)Store, "00000000-0000-0000-0000-000000000000", Guid.Empty },
381new object[] { (Action<HttpContext, Version>)Store, "6.0.0.42", new Version("6.0.0.42") },
382new object[] { (Action<HttpContext, BigInteger>)Store, "-42", new BigInteger(-42) },
383new object[] { (Action<HttpContext, IPAddress>)Store, "127.0.0.1", IPAddress.Loopback },
384new object[] { (Action<HttpContext, IPEndPoint>)Store, "127.0.0.1:80", new IPEndPoint(IPAddress.Loopback, 80) },
385new object[] { (Action<HttpContext, AddressFamily>)Store, "Unix", AddressFamily.Unix },
386new object[] { (Action<HttpContext, ILOpCode>)Store, "Nop", ILOpCode.Nop },
387new object[] { (Action<HttpContext, AssemblyFlags>)Store, "PublicKey,Retargetable", AssemblyFlags.PublicKey | AssemblyFlags.Retargetable },
388new object[] { (Action<HttpContext, int?>)Store, "42", 42 },
389new object[] { (Action<HttpContext, MyEnum>)Store, "ValueB", MyEnum.ValueB },
390new object[] { (Action<HttpContext, MyTryParseRecord>)Store, "https://example.org", new MyTryParseRecord(new Uri("https://example.org")) },
391new object?[] { (Action<HttpContext, int?>)Store, null, null },
415public static ValueTask<MyBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter)
436public static ValueTask<MyNullableBindAsyncStruct?> BindAsync(HttpContext context, ParameterInfo parameter)
452public static ValueTask<MyBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
473public static async ValueTask<MyAwaitedBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter)
491public static async ValueTask<MyAwaitedBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
509public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
523public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context)
531public static ValueTask<MySimpleBindAsyncStruct> BindAsync(HttpContext context)
544public static ValueTask<MySimpleBindAsyncRecord?> BindAsync(HttpContext context)
557static ValueTask<T?> BindAsync(HttpContext context)
609static void StoreNullableIntArray(HttpContext httpContext, int?[]? tryParsable)
640var factoryResult = RequestDelegateFactory.Create((HttpContext context,
665var factoryResult = RequestDelegateFactory.Create((HttpContext context,
697(HttpContext context, [FromForm(Name = "form")] string[] formValues) =>
723(HttpContext httpContext, MyAwaitedBindAsyncRecord myAwaitedBindAsyncRecord, MyAwaitedBindAsyncStruct myAwaitedBindAsyncStruct) =>
775void StoreNullableIntArray(HttpContext httpContext, int?[] values)
805private record ParametersListWithImplictFromBody(HttpContext HttpContext, TodoStruct Todo);
807private record ParametersListWithExplictFromBody(HttpContext HttpContext, [FromBody] Todo Todo);
813void TestImpliedFromBody(HttpContext httpContext, Todo todo)
818void TestImpliedFromBodyInterface(HttpContext httpContext, ITodo todo)
823void TestImpliedFromBodyStruct(HttpContext httpContext, TodoStruct todo)
835new[] { (Action<HttpContext, Todo>)TestImpliedFromBody },
836new[] { (Action<HttpContext, ITodo>)TestImpliedFromBodyInterface },
837new object[] { (Action<HttpContext, TodoStruct>)TestImpliedFromBodyStruct },
1000public static Task<BadBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter) =>
1006public static Task<BadBindAsyncClass> BindAsync(HttpContext context, ParameterInfo parameter) =>
1063private record ParametersListWithImplictFromService(HttpContext HttpContext, IMyService MyService);
1065private record ParametersListWithExplictFromService(HttpContext HttpContext, [FromService] MyService MyService);
1071void TestExplicitFromService(HttpContext httpContext, [FromService] MyService myService)
1081void TestExplicitFromIEnumerableService(HttpContext httpContext, [FromService] IEnumerable<MyService> myServices)
1086void TestExplicitMultipleFromService(HttpContext httpContext, [FromService] MyService myService, [FromService] IEnumerable<MyService> myServices)
1093new[] { (Action<HttpContext, MyService>)TestExplicitFromService },
1095new[] { (Action<HttpContext, IEnumerable<MyService>>)TestExplicitFromIEnumerableService },
1096new[] { (Action<HttpContext, MyService, IEnumerable<MyService>>)TestExplicitMultipleFromService },
1105void TestImpliedFromService(HttpContext httpContext, IMyService myService)
1115void TestImpliedIEnumerableFromService(HttpContext httpContext, IEnumerable<MyService> myServices)
1120void TestImpliedFromServiceBasedOnContainer(HttpContext httpContext, MyService myService)
1127new[] { (Action<HttpContext, IMyService>)TestImpliedFromService },
1129new[] { (Action<HttpContext, IEnumerable<MyService>>)TestImpliedIEnumerableFromService },
1130new[] { (Action<HttpContext, MyService>)TestImpliedFromServiceBasedOnContainer },
1223HttpContext? httpContextArgument = null;
1225void TestAction(HttpContext httpContext)
1628void requiredReferenceType(HttpContext context, MyBindAsyncRecord myBindAsyncRecord)
1632void defaultReferenceType(HttpContext context, MyBindAsyncRecord? myBindAsyncRecord = null)
1636void nullableReferenceType(HttpContext context, MyBindAsyncRecord? myBindAsyncRecord)
1640void requiredReferenceTypeSimple(HttpContext context, MySimpleBindAsyncRecord mySimpleBindAsyncRecord)
1645void requiredValueType(HttpContext context, MyNullableBindAsyncStruct myNullableBindAsyncStruct)
1649void defaultValueType(HttpContext context, MyNullableBindAsyncStruct? myNullableBindAsyncStruct = null)
1653void nullableValueType(HttpContext context, MyNullableBindAsyncStruct? myNullableBindAsyncStruct)
1657void requiredValueTypeSimple(HttpContext context, MySimpleBindAsyncStruct mySimpleBindAsyncStruct)
1664new object?[] { (Action<HttpContext, MyBindAsyncRecord>)requiredReferenceType, false, true, false },
1665new object?[] { (Action<HttpContext, MyBindAsyncRecord>)requiredReferenceType, true, false, false, },
1666new object?[] { (Action<HttpContext, MySimpleBindAsyncRecord>)requiredReferenceTypeSimple, true, false, false },
1668new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)defaultReferenceType, false, false, false, },
1669new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)defaultReferenceType, true, false, false },
1671new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)nullableReferenceType, false, false, false },
1672new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)nullableReferenceType, true, false, false },
1674new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct>)requiredValueType, false, true, true },
1675new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct>)requiredValueType, true, false, true },
1676new object?[] { (Action<HttpContext, MySimpleBindAsyncStruct>)requiredValueTypeSimple, true, false, true },
1678new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)defaultValueType, false, false, true },
1679new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)defaultValueType, true, false, true },
1681new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)nullableValueType, false, false, true },
1682new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)nullableValueType, true, false, true },
2070public static ValueTask<TraceIdentifier> BindAsync(HttpContext context)
2148void TestAction(HttpContext context, [AsParameters] SampleParameterList args, [AsParameters] SampleParameterList args2)
2231Func<HttpContext, object> targetFactory = (context) =>
2427async Task HandlerWithTaskAwait(HttpContext c)
3121var @delegate = (string name, HttpContext context) => context.Items.Add("param", name);
3148public HttpContext? HttpContext { get; set; }
3242public HttpContext HttpContext { get; set; }
3381public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
3386public static ValueTask<AccessesServicesMetadataBinder> BindAsync(HttpContext context, ParameterInfo parameter) =>
3413public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3423public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3434public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
3499public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
3550public static ValueTask<AddsCustomParameterMetadataBindable> BindAsync(HttpContext context, ParameterInfo parameter) => default;
3622public static async ValueTask<JsonTodo?> BindAsync(HttpContext context, ParameterInfo parameter)
3666public void Handle(HttpContext httpContext)
3690public Task ExecuteAsync(HttpContext httpContext)
3705public Task ExecuteAsync(HttpContext httpContext)
RequestDelegateFactoryTests.EndpointFilters.cs (52)
13[(Func<HttpContext, int>)((HttpContext httpContext) => 42)],
14[(Func<HttpContext, char>)((HttpContext httpContext) => 'b')],
15[(Func<HttpContext, bool>)((HttpContext httpContext) => true)],
16[(Func<HttpContext, float>)((HttpContext httpContext) => 4.2f)],
17[(Func<HttpContext, double>)((HttpContext httpContext) => 4.2)],
18[(Func<HttpContext, decimal>)((HttpContext httpContext) => 4.2m)],
19[(Func<HttpContext, long>)((HttpContext httpContext) => 42)],
20[(Func<HttpContext, short>)((HttpContext httpContext) => 42)],
21[(Func<HttpContext, byte>)((HttpContext httpContext) => 42)],
22[(Func<HttpContext, uint>)((HttpContext httpContext) => 42)],
23[(Func<HttpContext, ulong>)((HttpContext httpContext) => 42)],
24[(Func<HttpContext, ushort>)((HttpContext httpContext) => 42)],
25[(Func<HttpContext, sbyte>)((HttpContext httpContext) => 42)]
57[(Func<HttpContext, int?>)((HttpContext httpContext) => 42)],
58[(Func<HttpContext, char?>)((HttpContext httpContext) => 'b')],
59[(Func<HttpContext, bool?>)((HttpContext httpContext) => true)],
60[(Func<HttpContext, float?>)((HttpContext httpContext) => 4.2f)],
61[(Func<HttpContext, double?>)((HttpContext httpContext) => 4.2)],
62[(Func<HttpContext, decimal?>)((HttpContext httpContext) => 4.2m)],
63[(Func<HttpContext, long?>)((HttpContext httpContext) => 42)],
64[(Func<HttpContext, short?>)((HttpContext httpContext) => 42)],
65[(Func<HttpContext, byte?>)((HttpContext httpContext) => 42)],
66[(Func<HttpContext, uint?>)((HttpContext httpContext) => 42)],
67[(Func<HttpContext, ulong?>)((HttpContext httpContext) => 42)],
68[(Func<HttpContext, ushort?>)((HttpContext httpContext) => 42)],
69[(Func<HttpContext, sbyte?>)((HttpContext httpContext) => 42)]
RequestDelegateGenerator\SharedTypes.cs (54)
89public static async ValueTask<JsonTodo?> BindAsync(HttpContext context, ParameterInfo parameter)
202public static async ValueTask<CustomTodo?> BindAsync(HttpContext context, ParameterInfo parameter)
215public static ValueTask<MyBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter)
242public static ValueTask<MyNullableBindAsyncStruct?> BindAsync(HttpContext context, ParameterInfo parameter)
267public static ValueTask<MyBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
294public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
314public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context) =>
320public static ValueTask<MySimpleBindAsyncStruct> BindAsync(HttpContext context)
336public static ValueTask<MySimpleBindAsyncRecord?> BindAsync(HttpContext context)
352static ValueTask<T?> BindAsync(HttpContext context)
370public static ValueTask<MyBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter) =>
385public static ValueTask<T?> BindAsync(HttpContext context)
415public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter)
439static ValueTask<BindAsyncFromExplicitStaticAbstractInterface?> IBindableFromHttpContext<BindAsyncFromExplicitStaticAbstractInterface>.BindAsync(HttpContext context, ParameterInfo parameter)
461public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter) =>
467public static ValueTask<MyBindAsyncTypeThatThrows?> BindAsync(HttpContext context, ParameterInfo parameter) =>
534public static ValueTask<TraceIdentifier> BindAsync(HttpContext context)
557public static ValueTask<AddsCustomParameterMetadataBindable> BindAsync(HttpContext context, ParameterInfo parameter) => default;
624public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
637public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
675public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
680public static ValueTask<AccessesServicesMetadataBinder> BindAsync(HttpContext context, ParameterInfo parameter) =>
693public record ParameterListFromQuery(HttpContext HttpContext,
697public record ParameterListFromRoute(HttpContext HttpContext, int Value);
698public record ParameterListFromHeader(HttpContext HttpContext, [FromHeader(Name = "X-Custom-Header")] int Value);
702public HttpContext HttpContext { get; set; }
707public record ParametersListWithImplicitFromBody(HttpContext HttpContext, TodoStruct Todo);
709public record ParametersListWithExplicitFromBody(HttpContext HttpContext, [FromBody] Todo Todo);
711HttpContext HttpContext,
716public record struct ParameterListRecordStruct(HttpContext HttpContext, [FromRoute] int Value);
718public record ParameterListRecordClass(HttpContext HttpContext, [FromRoute] int Value);
724public HttpContext? HttpContext { get; set; }
733public HttpContext HttpContext { get; set; }
747public HttpContext HttpContext { get; set; }
755public ParameterListStructWithParameterizedContructor(HttpContext httpContext)
761public HttpContext HttpContext { get; set; }
768public ParameterListStructWithMultipleParameterizedContructor(HttpContext httpContext)
774public ParameterListStructWithMultipleParameterizedContructor(HttpContext httpContext, [FromHeader(Name = "Value")] int value)
780public HttpContext HttpContext { get; set; }
789public HttpContext? HttpContext { get; set; }
798public ParameterListClassWithParameterizedContructor(HttpContext httpContext)
804public HttpContext HttpContext { get; set; }
811public ParameterListWitDefaultValue(HttpContext httpContext, [FromRoute] int value = 42)
817public HttpContext HttpContext { get; }
842HttpContext HttpContext,
847HttpContext HttpContext,
852public HttpContext HttpContext { get; set; }
931public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
975Task IResult.ExecuteAsync(HttpContext httpContext)
1054public static async ValueTask<BindableWithMismatchedNullability<T?>> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1070public static async ValueTask<BindableStructWithMismatchedNullability<T?>> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1079public static async ValueTask<BindableClassWithNullReturn?> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1088public static async ValueTask<BindableStructWithNullReturn?> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1104public static async ValueTask<BindableStruct> BindAsync(HttpContext httpContext, ParameterInfo parameter)
Microsoft.AspNetCore.Http.Microbenchmarks (68)
src\Http\Http.Extensions\test\RequestDelegateGenerator\SharedTypes.cs (54)
89public static async ValueTask<JsonTodo?> BindAsync(HttpContext context, ParameterInfo parameter)
202public static async ValueTask<CustomTodo?> BindAsync(HttpContext context, ParameterInfo parameter)
215public static ValueTask<MyBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter)
242public static ValueTask<MyNullableBindAsyncStruct?> BindAsync(HttpContext context, ParameterInfo parameter)
267public static ValueTask<MyBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
294public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
314public static ValueTask<MyBothBindAsyncStruct> BindAsync(HttpContext context) =>
320public static ValueTask<MySimpleBindAsyncStruct> BindAsync(HttpContext context)
336public static ValueTask<MySimpleBindAsyncRecord?> BindAsync(HttpContext context)
352static ValueTask<T?> BindAsync(HttpContext context)
370public static ValueTask<MyBindAsyncRecord?> BindAsync(HttpContext context, ParameterInfo parameter) =>
385public static ValueTask<T?> BindAsync(HttpContext context)
415public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter)
439static ValueTask<BindAsyncFromExplicitStaticAbstractInterface?> IBindableFromHttpContext<BindAsyncFromExplicitStaticAbstractInterface>.BindAsync(HttpContext context, ParameterInfo parameter)
461public static ValueTask<BindAsyncFromImplicitStaticAbstractInterface?> BindAsync(HttpContext context, ParameterInfo parameter) =>
467public static ValueTask<MyBindAsyncTypeThatThrows?> BindAsync(HttpContext context, ParameterInfo parameter) =>
534public static ValueTask<TraceIdentifier> BindAsync(HttpContext context)
557public static ValueTask<AddsCustomParameterMetadataBindable> BindAsync(HttpContext context, ParameterInfo parameter) => default;
624public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
637public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
675public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
680public static ValueTask<AccessesServicesMetadataBinder> BindAsync(HttpContext context, ParameterInfo parameter) =>
693public record ParameterListFromQuery(HttpContext HttpContext,
697public record ParameterListFromRoute(HttpContext HttpContext, int Value);
698public record ParameterListFromHeader(HttpContext HttpContext, [FromHeader(Name = "X-Custom-Header")] int Value);
702public HttpContext HttpContext { get; set; }
707public record ParametersListWithImplicitFromBody(HttpContext HttpContext, TodoStruct Todo);
709public record ParametersListWithExplicitFromBody(HttpContext HttpContext, [FromBody] Todo Todo);
711HttpContext HttpContext,
716public record struct ParameterListRecordStruct(HttpContext HttpContext, [FromRoute] int Value);
718public record ParameterListRecordClass(HttpContext HttpContext, [FromRoute] int Value);
724public HttpContext? HttpContext { get; set; }
733public HttpContext HttpContext { get; set; }
747public HttpContext HttpContext { get; set; }
755public ParameterListStructWithParameterizedContructor(HttpContext httpContext)
761public HttpContext HttpContext { get; set; }
768public ParameterListStructWithMultipleParameterizedContructor(HttpContext httpContext)
774public ParameterListStructWithMultipleParameterizedContructor(HttpContext httpContext, [FromHeader(Name = "Value")] int value)
780public HttpContext HttpContext { get; set; }
789public HttpContext? HttpContext { get; set; }
798public ParameterListClassWithParameterizedContructor(HttpContext httpContext)
804public HttpContext HttpContext { get; set; }
811public ParameterListWitDefaultValue(HttpContext httpContext, [FromRoute] int value = 42)
817public HttpContext HttpContext { get; }
842HttpContext HttpContext,
847HttpContext HttpContext,
852public HttpContext HttpContext { get; set; }
931public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
975Task IResult.ExecuteAsync(HttpContext httpContext)
1054public static async ValueTask<BindableWithMismatchedNullability<T?>> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1070public static async ValueTask<BindableStructWithMismatchedNullability<T?>> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1079public static async ValueTask<BindableClassWithNullReturn?> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1088public static async ValueTask<BindableStructWithNullReturn?> BindAsync(HttpContext httpContext, ParameterInfo parameter)
1104public static async ValueTask<BindableStruct> BindAsync(HttpContext httpContext, ParameterInfo parameter)
Microsoft.AspNetCore.Http.Results (72)
Microsoft.AspNetCore.Http.Results.Tests (235)
ForbidResultTests.cs (6)
21.Setup(c => c.ForbidAsync(It.IsAny<HttpContext>(), "", null))
41.Setup(c => c.ForbidAsync(It.IsAny<HttpContext>(), "Scheme1", authProperties))
45.Setup(c => c.ForbidAsync(It.IsAny<HttpContext>(), "Scheme2", authProperties))
73.Setup(c => c.ForbidAsync(It.IsAny<HttpContext>(), null, expected))
94.Setup(c => c.ForbidAsync(It.IsAny<HttpContext>(), null, expected))
116HttpContext httpContext = null;
TestLinkGenerator.cs (2)
13public override string GetPathByAddress<TAddress>(HttpContext httpContext, TAddress address, RouteValueDictionary values, RouteValueDictionary ambientValues = null, PathString? pathBase = null, FragmentString fragment = default, LinkOptions options = null)
23public override string GetUriByAddress<TAddress>(HttpContext httpContext, TAddress address, RouteValueDictionary values, RouteValueDictionary ambientValues = null, string scheme = null, HostString? host = null, PathString? pathBase = null, FragmentString fragment = default, LinkOptions options = null)
Microsoft.AspNetCore.Http.Tests (6)
Microsoft.AspNetCore.HttpLogging (5)
Microsoft.AspNetCore.HttpLogging.Tests (10)
HttpLoggingMiddlewareTests.cs (10)
2057endpoint.MapGet("/", async (HttpContext c) =>
2120private static async Task RequestResponseApp(HttpContext context)
2163endpoint.MapGet("/attr_responseonly", [HttpLogging(HttpLoggingFields.Response)] async (HttpContext c) =>
2169endpoint.MapGet("/ext_responseonly", async (HttpContext c) =>
2175endpoint.MapGet("/attr_responseandrequest", [HttpLogging(HttpLoggingFields.All)] async (HttpContext c) =>
2182endpoint.MapGet("/ext_responseandrequest", async(HttpContext c) =>
2188endpoint.MapGet("/attr_restrictedheaders", [HttpLogging((HttpLoggingFields.Request & ~HttpLoggingFields.RequestScheme) | (HttpLoggingFields.Response & ~HttpLoggingFields.ResponseStatusCode))] async (HttpContext c) =>
2194endpoint.MapGet("/ext_restrictedheaders", async (HttpContext c) =>
2200endpoint.MapGet("/attr_restrictedsize", [HttpLogging(HttpLoggingFields.RequestBody | HttpLoggingFields.ResponseBody, RequestBodyLogLimit = 3, ResponseBodyLogLimit = 6)] async (HttpContext c) =>
2206endpoint.MapGet("/ext_restrictedsize", async (HttpContext c) =>
Microsoft.AspNetCore.HttpOverrides (10)
Microsoft.AspNetCore.HttpOverrides.Tests (31)
Microsoft.AspNetCore.HttpsPolicy (3)
Microsoft.AspNetCore.Identity (26)
IdentityApiEndpointRouteBuilderExtensions.cs (4)
58([FromBody] RegisterRequest registration, HttpContext context, [FromServices] IServiceProvider sp) =>
194([FromBody] ResendConfirmationEmailRequest resendRequest, HttpContext context, [FromServices] IServiceProvider sp) =>
349(ClaimsPrincipal claimsPrincipal, [FromBody] InfoRequest infoRequest, HttpContext context, [FromServices] IServiceProvider sp) =>
390async Task SendConfirmationEmailAsync(TUser user, UserManager<TUser> userManager, HttpContext context, string email, bool isChange = false)
Microsoft.AspNetCore.Identity.InMemory.Test (2)
Microsoft.AspNetCore.Identity.Test (26)
SignInManagerTest.cs (14)
32var context = new Mock<HttpContext>();
50var context = new Mock<HttpContext>();
94var context = new Mock<HttpContext>();
137HttpContext context,
440.Setup(h => h.MakeRequestOptionsAsync(user, It.IsAny<HttpContext>()))
489private static void SetupPasskeyAuth(HttpContext context, Mock<IAuthenticationService> auth)
501.Callback((HttpContext context, string scheme, ClaimsPrincipal claimsPrincipal, AuthenticationProperties authenticationProperties) =>
1143private Mock<IAuthenticationService> MockAuth(HttpContext context)
1217var context = new Mock<HttpContext>();
1249var context = new Mock<HttpContext>();
1276var context = new Mock<HttpContext>();
1303var context = new Mock<HttpContext>();
1362private static void SetupSignIn(HttpContext context, Mock<IAuthenticationService> auth, string userId = null, bool? isPersistent = null, string loginProvider = null, string amr = null)
1666private static SignInManager<PocoUser> SetupSignInManagerType(UserManager<PocoUser> manager, HttpContext context, string typeName)
Microsoft.AspNetCore.Localization (11)
Microsoft.AspNetCore.Localization.Routing (1)
Microsoft.AspNetCore.Localization.Tests (1)
Microsoft.AspNetCore.MiddlewareAnalysis (2)
Microsoft.AspNetCore.MiddlewareAnalysis.Tests (2)
Microsoft.AspNetCore.Mvc.Abstractions (26)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (10)
EndpointMetadataApiDescriptionProviderTest.cs (9)
651public Task ExecuteAsync(HttpContext httpContext)
827Assert.Empty(GetApiDescription((HttpContext context) => { }).ParameterDescriptions);
1889public static ValueTask<BindAsyncRecord> BindAsync(HttpContext context, ParameterInfo parameter) =>
1895private record ArgumentListRecord([FromRoute] int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context);
1897private record struct ArgumentListRecordStruct([FromRoute] int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context);
1899private record ArgumentListRecordWithoutAttributes(int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context);
1907public HttpContext Context { get; set; } = null!;
1916public HttpContext Context { get; set; } = null!;
1930public HttpContext Context { get; set; }
Microsoft.AspNetCore.Mvc.Core (96)
Routing\DynamicRouteValueTransformer.cs (13)
20/// The route values returned from a <see cref="TransformAsync(HttpContext, RouteValueDictionary)"/> implementation
23/// <see cref="FilterAsync(HttpContext, RouteValueDictionary, IReadOnlyList{Endpoint})" /> as well as
32/// <item><description><see cref="TransformAsync(HttpContext, RouteValueDictionary)"/></description></item>
33/// <item><description><see cref="FilterAsync(HttpContext, RouteValueDictionary, IReadOnlyList{Endpoint})" /></description></item>
59/// <param name="httpContext">The <see cref="HttpContext" /> associated with the current request.</param>
62public abstract ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values);
66/// <see cref="TransformAsync(HttpContext, RouteValueDictionary)" />.
68/// <param name="httpContext">The <see cref="HttpContext" /> associated with the current request.</param>
69/// <param name="values">The route values returned from <see cref="TransformAsync(HttpContext, RouteValueDictionary)" />.</param>
72/// <see cref="TransformAsync(HttpContext, RouteValueDictionary)" />.
77/// Implementations of <see cref="FilterAsync(HttpContext, RouteValueDictionary, IReadOnlyList{Endpoint})" /> may further
82/// <see cref="FilterAsync(HttpContext, RouteValueDictionary, IReadOnlyList{Endpoint})" /> will not be called in the case
86public virtual ValueTask<IReadOnlyList<Endpoint>> FilterAsync(HttpContext httpContext, RouteValueDictionary values, IReadOnlyList<Endpoint> endpoints)
src\Shared\ChunkingCookieManager\ChunkingCookieManager.cs (4)
90public string? GetRequestCookie(HttpContext context, string key)
145public void AppendResponseCookie(HttpContext context, string key, string? value, CookieOptions options)
224public void DeleteCookie(HttpContext context, string key, CookieOptions options)
312private static void DeleteChunks(HttpContext context, IRequestCookieCollection requestCookies, CookieOptions options, string key, int startChunk, int endChunk)
Microsoft.AspNetCore.Mvc.Core.Test (296)
Routing\DynamicControllerEndpointMatcherPolicyTest.cs (6)
92private Func<HttpContext, RouteValueDictionary, object, ValueTask<RouteValueDictionary>> Transform { get; set; }
94private Func<HttpContext, RouteValueDictionary, object, IReadOnlyList<Endpoint>, ValueTask<IReadOnlyList<Endpoint>>> Filter { get; set; } = (_, __, ___, e) => new ValueTask<IReadOnlyList<Endpoint>>(e);
447public Func<HttpContext, RouteValueDictionary, object, ValueTask<RouteValueDictionary>> Transform { get; set; }
449public Func<HttpContext, RouteValueDictionary, object, IReadOnlyList<Endpoint>, ValueTask<IReadOnlyList<Endpoint>>> Filter { get; set; }
451public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
456public override ValueTask<IReadOnlyList<Endpoint>> FilterAsync(HttpContext httpContext, RouteValueDictionary values, IReadOnlyList<Endpoint> endpoints)
Routing\UrlHelperTest.cs (4)
22var httpContext = CreateHttpContext(services, appRoot, host, protocol);
37var httpContext = CreateHttpContext(services, appRoot, host, protocol);
52var context = CreateHttpContext(services, appRoot, host, protocol);
77var httpContext = CreateHttpContext(services, appRoot, host, protocol);
Microsoft.AspNetCore.Mvc.Cors (1)
Microsoft.AspNetCore.Mvc.Cors.Test (3)
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (16)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Microsoft.AspNetCore.Mvc.IntegrationTests (15)
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (47)
Microsoft.AspNetCore.Mvc.Razor (7)
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (2)
Microsoft.AspNetCore.Mvc.Razor.Test (8)
Microsoft.AspNetCore.Mvc.RazorPages (7)
Microsoft.AspNetCore.Mvc.RazorPages.Test (14)
Infrastructure\DynamicPageEndpointMatcherPolicyTest.cs (6)
111private Func<HttpContext, RouteValueDictionary, object, ValueTask<RouteValueDictionary>> Transform { get; set; }
113private Func<HttpContext, RouteValueDictionary, object, IReadOnlyList<Endpoint>, ValueTask<IReadOnlyList<Endpoint>>> Filter { get; set; } = (_, __, ___, e) => new ValueTask<IReadOnlyList<Endpoint>>(e);
447public Func<HttpContext, RouteValueDictionary, object, ValueTask<RouteValueDictionary>> Transform { get; set; }
449public Func<HttpContext, RouteValueDictionary, object, IReadOnlyList<Endpoint>, ValueTask<IReadOnlyList<Endpoint>>> Filter { get; set; }
451public override ValueTask<IReadOnlyList<Endpoint>> FilterAsync(HttpContext httpContext, RouteValueDictionary values, IReadOnlyList<Endpoint> endpoints)
456public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
Microsoft.AspNetCore.Mvc.TagHelpers (2)
Microsoft.AspNetCore.Mvc.Test (10)
Microsoft.AspNetCore.Mvc.ViewFeatures (26)
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (50)
Microsoft.AspNetCore.OpenApi (6)
Microsoft.AspNetCore.OpenApi.Tests (8)
Services\OpenApiGeneratorTests.cs (8)
419Assert.Empty(GetOpenApiOperation((HttpContext context) => { }).Parameters);
1093public static ValueTask<BindAsyncRecord> BindAsync(HttpContext context, ParameterInfo parameter) =>
1099private record ArgumentListRecord([FromRoute] int Foo, int Bar, InferredJsonClass FromBody, HttpContext context);
1101private record struct ArgumentListRecordStruct([FromRoute] int Foo, int Bar, InferredJsonClass FromBody, HttpContext context);
1103private record ArgumentListRecordWithoutAttributes(int Foo, int Bar, InferredJsonClass FromBody, HttpContext context);
1111public HttpContext Context { get; set; }
1120public HttpContext Context { get; set; }
1134public HttpContext Context { get; set; }
Microsoft.AspNetCore.OutputCaching (18)
OutputCachePolicyBuilder.cs (8)
170ValueTask<string> varyByKeyFunc(HttpContext context, CancellationToken cancellationToken)
182public OutputCachePolicyBuilder SetCacheKeyPrefix(Func<HttpContext, string> keyPrefix)
186ValueTask<string> varyByKeyFunc(HttpContext context, CancellationToken cancellationToken)
198public OutputCachePolicyBuilder SetCacheKeyPrefix(Func<HttpContext, CancellationToken, ValueTask<string>> keyPrefix)
215ValueTask<KeyValuePair<string, string>> varyByFunc(HttpContext context, CancellationToken cancellationToken)
227public OutputCachePolicyBuilder VaryByValue(Func<HttpContext, KeyValuePair<string, string>> varyBy)
231ValueTask<KeyValuePair<string, string>> varyByFunc(HttpContext context, CancellationToken cancellationToken)
243public OutputCachePolicyBuilder VaryByValue(Func<HttpContext, CancellationToken, ValueTask<KeyValuePair<string, string>>> varyBy)
Microsoft.AspNetCore.OutputCaching.Tests (8)
Microsoft.AspNetCore.Owin (13)
Microsoft.AspNetCore.Owin.Microbenchmarks (2)
Microsoft.AspNetCore.Owin.Tests (13)
Microsoft.AspNetCore.RateLimiting (21)
Microsoft.AspNetCore.RateLimiting.Tests (15)
Microsoft.AspNetCore.RequestDecompression (6)
Microsoft.AspNetCore.RequestDecompression.Tests (3)
Microsoft.AspNetCore.ResponseCaching (6)
Microsoft.AspNetCore.ResponseCaching.Tests (5)
Microsoft.AspNetCore.ResponseCompression (14)
Microsoft.AspNetCore.ResponseCompression.Tests (3)
Microsoft.AspNetCore.Rewrite (4)
Microsoft.AspNetCore.Rewrite.Tests (4)
Microsoft.AspNetCore.Routing (104)
Microsoft.AspNetCore.Routing.Abstractions (24)
Microsoft.AspNetCore.Routing.Microbenchmarks (28)
Microsoft.AspNetCore.Routing.Tests (333)
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (9)
136_ = builder.MapGet("/{id}", (int? id, HttpContext httpContext) =>
174_ = builder.MapGet("/", (int? id, HttpContext httpContext) =>
509map(builder, "/{ID}", ([FromRoute] int? id, HttpContext httpContext) =>
551map(builder, "/{ID}", (int? id, HttpContext httpContext) =>
604_ = builder.MapGet("/{value}", ([FromRoute(Name = "value")] int id, HttpContext httpContext) =>
627_ = builder.MapGet("/{value}", ([FromRoute(Name = "value")] int id, HttpContext httpContext) =>
652_ = builder.MapGet("/{id}", ([FromRoute(Name = "value")] int id, HttpContext httpContext) => { });
963string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}";
996string? PrintLogger(HttpContext context) => $"loggerErrorIsEnabled: {context.Items["loggerErrorIsEnabled"]}, parentName: {context.Items["parentName"]}";
ConstraintMatcherTest.cs (10)
33httpContext: new Mock<HttpContext>().Object,
95httpContext: new Mock<HttpContext>().Object,
115httpContext: new Mock<HttpContext>().Object,
135httpContext: new Mock<HttpContext>().Object,
155httpContext: new Mock<HttpContext>().Object,
175httpContext: new Mock<HttpContext>().Object,
187httpContext: new Mock<HttpContext>().Object,
205httpContext: new Mock<HttpContext>().Object,
222HttpContext httpContext,
240HttpContext httpContext,
DefaultLinkGeneratorProcessTemplateTest.cs (54)
45var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
77var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
100var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
123var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
146var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
169var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
192var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
215var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Index" });
238var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
266var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
295var httpContext = CreateHttpContext();
319var httpContext = CreateHttpContext();
351var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
390var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
420var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
455var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
485var httpContext = CreateHttpContext(ambientValues: new { controller = "HoMe" });
518var httpContext = CreateHttpContext(ambientValues: new { controller = "HoMe" });
555var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
593var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
627var httpContext = CreateHttpContext(ambientValues: new { controller = "Home" });
653var httpContext = CreateHttpContext(ambientValues: new { });
677var httpContext = CreateHttpContext(ambientValues: new { });
703var httpContext = CreateHttpContext(ambientValues: new { });
727var httpContext = CreateHttpContext(ambientValues: new { });
752It.IsAny<HttpContext>(),
764var httpContext = CreateHttpContext(ambientValues: new { });
795var httpContext = CreateHttpContext(
829var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Blog" });
861var httpContext = CreateHttpContext(ambientValues: new { controller = "Home", action = "Blog" });
893var httpContext = CreateHttpContext(
927var httpContext = hasHttpContext ? CreateHttpContext(new { }) : null;
953var httpContext = CreateHttpContext(ambientValues: new { });
979var httpContext = hasHttpContext ? CreateHttpContext(new { }) : null;
1005var httpContext = CreateHttpContext(ambientValues: new { });
1031var httpContext = CreateHttpContext(ambientValues: new { });
1057var httpContext = hasHttpContext ? CreateHttpContext(new { }) : null;
1085var httpContext = hasHttpContext ? CreateHttpContext(new { }) : null;
1110var httpContext = CreateHttpContext(ambientValues: new { });
1133var httpContext = CreateHttpContext(ambientValues: new { });
1156var httpContext = CreateHttpContext(ambientValues: new { });
1181var httpContext = CreateHttpContext(ambientValues: new { });
1206var httpContext = CreateHttpContext(ambientValues: new { });
1229var httpContext = CreateHttpContext(ambientValues: new { });
1253var httpContext = CreateHttpContext(ambientValues: new { });
1276var httpContext = CreateHttpContext(ambientValues: new { });
1298var httpContext = CreateHttpContext(ambientValues: new { });
1321var httpContext = CreateHttpContext(ambientValues: new { c = "17" });
1344var httpContext = CreateHttpContext(ambientValues: new { c = "17" });
1367var httpContext = CreateHttpContext(ambientValues: new { d = "17" });
1471var httpContext = CreateHttpContext(ambientValues);
1499var httpContext = CreateHttpContext(ambientValues: new { c = "Products", a = "Edit", id = 10 });
1527var httpContext = CreateHttpContext(ambientValues: new { c = "Products", a = "Edit", id = 10 });
1635var httpContext = CreateHttpContext(ambientValues);
Matching\DfaMatcherTest.cs (37)
72var httpContext = CreateContext();
93var httpContext = CreateContext();
122var httpContext = CreateContext();
148var httpContext = CreateContext();
187var httpContext = CreateContext();
213var httpContext = CreateContext();
262var httpContext = CreateContext();
297var httpContext = CreateContext();
331var httpContext = CreateContext();
565private (HttpContext context, string path, int count) CreateMatchingContext(string requestPath, PathSegment[] buffer)
567var context = CreateContext();
591var httpContext = CreateContext();
629var httpContext = CreateContext();
648.Setup(s => s.SelectAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
649.Callback<HttpContext, CandidateSet>((c, cs) =>
675var httpContext = CreateContext();
694.Setup(s => s.SelectAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
695.Callback<HttpContext, CandidateSet>((c, cs) =>
721var httpContext = CreateContext();
741.Setup(s => s.SelectAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
742.Callback<HttpContext, CandidateSet>((c, cs) =>
768var httpContext = CreateContext();
790var httpContext = CreateContext();
820var httpContext = CreateContext();
860var httpContext = CreateContext();
902var httpContext = CreateContext();
962.Setup(p => p.ApplyAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
963.Returns<HttpContext, CandidateSet>((c, cs) =>
971var httpContext = CreateContext();
998.Setup(p => p.ApplyAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
999.Returns<HttpContext, CandidateSet>((c, cs) =>
1006var httpContext = CreateContext();
1033.Setup(p => p.ApplyAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
1034.Returns<HttpContext, CandidateSet>((c, cs) =>
1050.Setup(p => p.ApplyAsync(It.IsAny<HttpContext>(), It.IsAny<CandidateSet>()))
1055var httpContext = CreateContext();
1065private HttpContext CreateContext()
Matching\HostMatcherPolicyIntegrationTestBase.cs (23)
22var httpContext = CreateContext("/hello", "contoso.com");
38var httpContext = CreateContext("/hello", "contoso.com:8080");
54var httpContext = CreateContext("/hello", "æon.contoso.com");
70var httpContext = CreateContext("/hello", "contoso.com:1111");
86var httpContext = CreateContext("/hello", "www.contoso.com:8080");
102var httpContext = CreateContext("/hello", "æon.contoso.com:8080");
118var httpContext = CreateContext("/hello", "contoso.com:8080");
134var httpContext = CreateContext("/hello", "www.contoso.com:8080");
150var httpContext = CreateContext("/hello", "www.blog.contoso.com:8080");
166var httpContext = CreateContext("/hello", "mycontoso.com:8080");
182var httpContext = CreateContext("/hello", "contoso.com:8080");
198var httpContext = CreateContext("/hello", "contoso.com");
214var httpContext = CreateContext("/hello", "contoso.com", "http");
230var httpContext = CreateContext("/hello", "contoso.com", "https");
246var httpContext = CreateContext("/hello", null, "https");
262var httpContext = CreateContext("/hello", null, "https");
278var httpContext = CreateContext("/hello", "contoso.com");
294var httpContext = CreateContext("/hello", "contoso.com");
310var httpContext = CreateContext("/hello", "contoso.com");
326var httpContext = CreateContext("/hello", "contoso.com");
342var httpContext = CreateContext("/hello", "contoso.com");
358var httpContext = CreateContext("/hello", "nomatch.com");
384internal static HttpContext CreateContext(
Matching\HttpMethodMatcherPolicyIntegrationTestBase.cs (20)
24var httpContext = CreateContext("/hello", "GET");
40var httpContext = CreateContext("/hello", "GET");
56var httpContext = CreateContext("/hello", "GET", corsPreflight: true);
72var httpContext = CreateContext("/hello", "GET", corsPreflight: true);
91var httpContext = CreateContext("/hello", requestMethod);
109var httpContext = CreateContext("/hello", requestMethod, corsPreflight: true);
125var httpContext = CreateContext("/hello", "GET");
141var httpContext = CreateContext("/hello", "GET", corsPreflight: true);
157var httpContext = CreateContext("/hello", "GET", corsPreflight: true);
173var httpContext = CreateContext("/hello", "GET");
190var httpContext = CreateContext("/hello", "POST");
215var httpContext = CreateContext("/hello", "POST", corsPreflight: true);
232var httpContext = CreateContext("/hello", "POST");
249var httpContext = CreateContext("/hello", "GET");
266var httpContext = CreateContext("/hello", "GET");
283var httpContext = CreateContext("/hello", "POST");
300var httpContext = CreateContext("/hello", "POST");
332var httpContext1 = CreateContext("/hello", "GET");
339var httpContext2 = CreateContext("/hello", "GOT");
363internal static HttpContext CreateContext(
Microsoft.AspNetCore.Security.Microbenchmarks (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (4)
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (4)
Microsoft.AspNetCore.Server.IIS (8)
Microsoft.AspNetCore.Server.IISIntegration (7)
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (11)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (13)
Microsoft.AspNetCore.Session (4)
Microsoft.AspNetCore.SignalR (7)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
Microsoft.AspNetCore.SignalR.Tests (3)
Microsoft.AspNetCore.SpaProxy (2)
Microsoft.AspNetCore.SpaServices.Extensions (7)
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
Microsoft.AspNetCore.StaticAssets (12)
Microsoft.AspNetCore.StaticFiles (20)
Microsoft.AspNetCore.StaticFiles.FunctionalTests (4)
Microsoft.AspNetCore.TestHost (23)
Microsoft.AspNetCore.TestHost.Tests (15)
Microsoft.AspNetCore.Testing.Tests (1)
Microsoft.AspNetCore.Tests (2)
Microsoft.AspNetCore.WebSockets (10)
Microsoft.AspNetCore.WebSockets.Tests (2)
Microsoft.Extensions.Validation.GeneratorTests (49)
ValidationsGenerator.ComplexType.cs (15)
93var context = CreateHttpContextWithPayload(payload, serviceProvider);
106var context = CreateHttpContextWithPayload(payload, serviceProvider);
131var context = CreateHttpContextWithPayload(payload, serviceProvider);
144var context = CreateHttpContextWithPayload(payload, serviceProvider);
281var context = CreateHttpContextWithPayload(payload, serviceProvider);
300var context = CreateHttpContextWithPayload(payload, serviceProvider);
319var context = CreateHttpContextWithPayload(payload, serviceProvider);
341var context = CreateHttpContextWithPayload(payload, serviceProvider);
370var context = CreateHttpContextWithPayload(payload, serviceProvider);
413var context = CreateHttpContextWithPayload(payload, serviceProvider);
443var context = CreateHttpContextWithPayload(payload, serviceProvider);
462var context = CreateHttpContextWithPayload(payload, serviceProvider);
490var context = CreateHttpContextWithPayload(payload, serviceProvider);
528var context = CreateHttpContextWithPayload(payload, serviceProvider);
613var context = CreateHttpContextWithPayload(payload, serviceProvider);
ValidationsGenerator.RecordType.cs (10)
123var context = CreateHttpContextWithPayload(payload, serviceProvider);
142var context = CreateHttpContextWithPayload(payload, serviceProvider);
164var context = CreateHttpContextWithPayload(payload, serviceProvider);
193var context = CreateHttpContextWithPayload(payload, serviceProvider);
236var context = CreateHttpContextWithPayload(payload, serviceProvider);
266var context = CreateHttpContextWithPayload(payload, serviceProvider);
285var context = CreateHttpContextWithPayload(payload, serviceProvider);
313var context = CreateHttpContextWithPayload(payload, serviceProvider);
336var context = CreateHttpContextWithPayload(payload, serviceProvider);
379var context = CreateHttpContextWithPayload(payload, serviceProvider);
MiddlewareAnalysisSample (2)
MinimalFormSample (1)
MinimalSample (1)
Mvc.RoutingWebSite (6)
NegotiateAuthSample (1)
OpenIdConnectSample (1)
OutputCachingSample (1)
RateLimitingSample (2)
RazorPagesWebSite (2)
RoutingSandbox (3)
RoutingWebSite (2)
Sample (1)
SecurityWebSite (1)
ServerComparison.TestSites (1)
SocialSample (1)
SocialWeather (1)
Sockets.FunctionalTests (10)
StaticFilesAuth (2)
WebPubSubWeb (1)