1 type derived from HttpContext
Microsoft.AspNetCore.Http (1)
DefaultHttpContext.cs (1)
21public sealed class DefaultHttpContext : HttpContext
3832 references to HttpContext
Aspire.Dashboard (17)
Authentication\AspirePolicyEvaluator.cs (7)
33/// <see cref="ClaimsPrincipal"/> to <see cref="HttpContext.User"/>. If no schemes are set, this is a no-op. 36/// <param name="context">The <see cref="HttpContext"/>.</param> 38public virtual async Task<AuthenticateResult> AuthenticateAsync(AuthorizationPolicy policy, HttpContext context) 84static AuthenticateResult DefaultAuthenticateResult(HttpContext context) 96/// <param name="authenticationResult">The result of a call to <see cref="AuthenticateAsync(AuthorizationPolicy, HttpContext)"/>.</param> 97/// <param name="context">The <see cref="HttpContext"/>.</param> 105public virtual async Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource)
Components\Pages\Error.razor.cs (1)
12private HttpContext? HttpContext { get; set; }
DashboardWebApplication.cs (2)
420_app.MapPost("/api/validatetoken", async (string token, HttpContext httpContext, IOptionsMonitor<DashboardOptions> dashboardOptions) => 427_app.MapGet("/api/signout", async (HttpContext httpContext) =>
Model\BrowserSecurityHeadersMiddleware.cs (1)
63public Task InvokeAsync(HttpContext context)
Model\ValidateTokenMiddleware.cs (3)
27public async Task InvokeAsync(HttpContext context) 69private static void RedirectAfterValidation(HttpContext context) 81public static async Task<bool> TryAuthenticateAsync(string incomingBrowserToken, HttpContext httpContext, IOptionsMonitor<DashboardOptions> dashboardOptions)
Otlp\Http\OtlpHttpEndpointsBuilder.cs (3)
111public static async ValueTask<MessageBindable<TMessage>?> BindAsync(HttpContext context, ParameterInfo parameter) 146public async Task ExecuteAsync(HttpContext httpContext) 174HttpContext httpContext,
BasicLinkedApp (1)
Startup.cs (1)
26public Task InvokeAsync(HttpContext context)
BasicWebSite (3)
RequestIdMiddleware.cs (1)
16public Task Invoke(HttpContext context)
StartupWithoutEndpointRouting.cs (1)
61var httpContext = contextAccessor.HttpContext;
StoreIntoTempDataActionResult.cs (1)
14var httpContext = context.HttpContext;
Binding.Http.IntegrationTests (1)
MtomBindingTestHelper.cs (1)
52app.MapPost("/", async (HttpContext context) =>
blazor-devserver (1)
Server\Startup.cs (1)
107private static void ApplyCrossOriginPolicyHeaders(HttpContext httpContext)
ControllersFromServicesClassLibrary (1)
QueryValueService.cs (1)
10private readonly HttpContext _context;
CookiePolicySample (1)
Startup.cs (1)
77private async Task HomePage(HttpContext context)
CorsMiddlewareWebSite (2)
EchoMiddleware.cs (2)
21/// <param name="context">The <see cref="HttpContext"/> of the current request.</param> 23public Task Invoke(HttpContext context)
CustomAuthorizationFailureResponse (1)
Authorization\SampleAuthorizationMiddlewareResultHandler.cs (1)
27HttpContext httpContext,
Diagnostics.EFCore.FunctionalTests (11)
DatabaseErrorPageMiddlewareTest.cs (10)
54public virtual async Task Invoke(HttpContext context) 91public virtual Task Invoke(HttpContext context) 118public virtual Task Invoke(HttpContext context) 156public virtual Task Invoke(HttpContext context) 221public virtual Task Invoke(HttpContext context) 259public virtual Task Invoke(HttpContext context) 317public virtual async Task Invoke(HttpContext context) 418public virtual Task Invoke(HttpContext context) 467public virtual Task Invoke(HttpContext context) 501public virtual Task Invoke(HttpContext context)
MigrationsEndPointMiddlewareTest.cs (1)
51public virtual async Task Invoke(HttpContext context)
ExceptionHandlerSample (1)
StartupWithWebSocket.cs (1)
25app.Use(async (HttpContext context, Func<Task> next) =>
HealthChecksSample (1)
CustomWriterStartup.cs (1)
41private static Task WriteResponse(HttpContext httpContext, HealthReport result)
Http2SampleApp (1)
TimingMiddleware.cs (1)
21public async Task Invoke(HttpContext httpContext)
IIS.Microbenchmarks (1)
PlaintextBenchmark.cs (1)
54public Task Invoke(HttpContext httpContext)
InMemory.FunctionalTests (26)
ChunkedRequestTests.cs (3)
21private async Task App(HttpContext httpContext) 38private async Task PipeApp(HttpContext httpContext) 57private async Task AppChunked(HttpContext httpContext)
Http2\Http2TimeoutTests.cs (1)
331public async Task RunApp(HttpContext context)
Http3\Http3TimeoutTests.cs (1)
427public async Task RunApp(HttpContext context)
HttpsConnectionMiddlewareTests.cs (1)
1484private static async Task App(HttpContext httpContext)
KeepAliveTimeoutTests.cs (1)
258private async Task App(HttpContext httpContext, CancellationToken longRunningCt, CancellationToken upgradeCt)
KestrelMetricsTests.cs (2)
518static async Task UpgradeApp(HttpContext context) 917private static async Task EchoApp(HttpContext httpContext)
RequestTests.cs (6)
319Task ExecuteApplication(HttpContext context) 353Task ExecuteApplication(HttpContext context) 391Task ExecuteApplication(HttpContext context) 423async Task ExecuteApplication(HttpContext context) 461async Task ExecuteApplication(HttpContext context) 503async Task ExecuteApplication(HttpContext context)
ResponseTests.cs (2)
4689mockHttpContextFactory.Setup(f => f.Dispose(It.IsAny<HttpContext>())) 4690.Callback<HttpContext>(c =>
src\Servers\Kestrel\shared\test\DummyApplication.cs (4)
12public class DummyApplication : IHttpApplication<HttpContext> 33public HttpContext CreateContext(IFeatureCollection contextFeatures) 38public void DisposeContext(HttpContext context, Exception exception) 43public async Task ProcessRequestAsync(HttpContext context)
src\Servers\Kestrel\shared\test\TestApp.cs (5)
14public static async Task EchoApp(HttpContext httpContext) 27public static async Task EchoAppChunked(HttpContext httpContext) 39public static Task EmptyApp(HttpContext httpContext) 44public static async Task EchoAppPipeWriter(HttpContext httpContext) 61public static async Task EchoAppPipeWriterChunked(HttpContext httpContext)
InProcessWebSite (88)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.cs (86)
58private async Task ContentRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().ContentRootPath); 60private async Task WebRootPath(HttpContext ctx) => await ctx.Response.WriteAsync(ctx.RequestServices.GetService<Microsoft.AspNetCore.Hosting.IHostingEnvironment>().WebRootPath); 67private async Task CurrentDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.CurrentDirectory); 69private async Task BaseDirectory(HttpContext ctx) => await ctx.Response.WriteAsync(AppContext.BaseDirectory); 71private async Task IIISEnvironmentFeatureConfig(HttpContext ctx) 103private async Task ASPNETCORE_IIS_PHYSICAL_PATH(HttpContext ctx) => await ctx.Response.WriteAsync(Environment.GetEnvironmentVariable("ASPNETCORE_IIS_PHYSICAL_PATH")); 105private async Task ServerAddresses(HttpContext ctx) 111private async Task CheckProtocol(HttpContext ctx) 116private async Task ConsoleWrite(HttpContext ctx) 123private async Task ConsoleErrorWrite(HttpContext ctx) 130public async Task Auth(HttpContext ctx) 142public async Task GetClientCert(HttpContext context) 150public Task WaitForAbort(HttpContext context) 164public Task Abort(HttpContext context) 170public async Task WaitingRequestCount(HttpContext context) 175public Task CreateFile(HttpContext context) 192public Task ConnectionClose(HttpContext context) 198public Task OverrideServer(HttpContext context) 216private async Task GetEnvironmentVariable(HttpContext ctx) 221private async Task ServerVariable(HttpContext ctx) 233private async Task AuthenticationAnonymous(HttpContext ctx) 238private async Task AuthenticationRestricted(HttpContext ctx) 250private async Task AuthenticationForbidden(HttpContext ctx) 255private async Task AuthenticationRestrictedNTLM(HttpContext ctx) 267private Task PathAndPathBase(HttpContext ctx) 272private async Task FeatureCollectionSetRequestFeatures(HttpContext ctx) 327private async Task FeatureCollectionSetResponseFeatures(HttpContext ctx) 363private async Task FeatureCollectionSetConnectionFeatures(HttpContext ctx) 385private void Throw(HttpContext ctx) 390private async Task SetCustomErorCode(HttpContext ctx) 401private async Task HelloWorld(HttpContext ctx) 417private async Task LargeResponseBody(HttpContext ctx) 447private async Task ResponseHeaders(HttpContext ctx) 455private async Task ResponseEmptyHeaders(HttpContext ctx) 461private Task TestRequestHeaders(HttpContext ctx) 518private async Task ResponseInvalidOrdering(HttpContext ctx) 550private async Task ReadAndWriteSynchronously(HttpContext ctx) 557private async Task ReadRequestBody(HttpContext ctx) 570private async Task ReadRequestBodyLarger(HttpContext ctx) 584private async Task ReadAndCountRequestBody(HttpContext ctx) 596private async Task WaitForAppToStartShuttingDown(HttpContext ctx) 608private async Task ReadFullBody(HttpContext ctx) 618private async Task WriteManyTimesToResponseBody(HttpContext ctx) 626private async Task ReadAndWriteEcho(HttpContext ctx) 639private async Task ReadAndFlushEcho(HttpContext ctx) 654private async Task ReadAndWriteEchoLines(HttpContext ctx) 680private async Task ReadAndWriteEchoLinesNoBuffering(HttpContext ctx) 711private async Task ReadPartialBody(HttpContext ctx) 725private async Task SetHeaderFromBody(HttpContext ctx) 735private async Task ReadAndWriteEchoTwice(HttpContext ctx) 749private async Task ReadAndWriteSlowConnection(HttpContext ctx) 756private async Task WriteResponseBodyAFewTimes(HttpContext ctx) 764private async Task ReadAndWriteCopyToAsync(HttpContext ctx) 772private async Task TestReadOffsetWorks(HttpContext ctx) 781private async Task TestInvalidReadOperations(HttpContext ctx) 854private async Task TestValidReadOperations(HttpContext ctx) 878private async Task TestInvalidWriteOperations(HttpContext ctx) 941private async Task TestValidWriteOperations(HttpContext ctx) 955private async Task LargeResponseFile(HttpContext ctx) 981private async Task BasePath(HttpContext ctx) 986private Task RequestPath(HttpContext ctx) 992private async Task Shutdown(HttpContext ctx) 1002private async Task ShutdownStopAsync(HttpContext ctx) 1009private async Task ShutdownStopAsyncWithCancelledToken(HttpContext ctx) 1018private async Task StackSize(HttpContext ctx) 1025private async Task StackSizeLarge(HttpContext ctx) 1041private async Task StartupHook(HttpContext ctx) 1046private async Task GetServerVariableStress(HttpContext ctx) 1062private async Task CommandLineArgs(HttpContext ctx) 1067public Task HttpsHelloWorld(HttpContext ctx) => 1070public Task Path(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.Path.Value); 1072public Task Query(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Request.QueryString.Value); 1074public Task BodyLimit(HttpContext ctx) => ctx.Response.WriteAsync(ctx.Features.Get<IHttpMaxRequestBodySizeFeature>()?.MaxRequestBodySize?.ToString(CultureInfo.InvariantCulture) ?? "null"); 1076public Task Anonymous(HttpContext context) => context.Response.WriteAsync("Anonymous?" + !context.User.Identity.IsAuthenticated); 1078public Task Restricted(HttpContext context) 1091public Task Forbidden(HttpContext context) => context.ForbidAsync(IISDefaults.AuthenticationScheme); 1093public Task RestrictedNTLM(HttpContext context) 1105public Task UpgradeFeatureDetection(HttpContext context) => 1108public Task CheckRequestHandlerVersion(HttpContext context) 1126private async Task ProcessId(HttpContext context) 1131public async Task ANCM_HTTPS_PORT(HttpContext context) 1138public async Task HTTPS_PORT(HttpContext context) 1145public Task Latin1(HttpContext context) 1152public Task InvalidCharacter(HttpContext context) 1159private async Task TransferEncodingHeadersWithMultipleValues(HttpContext ctx) 1177private async Task TransferEncodingAndContentLengthShouldBeRemove(HttpContext ctx)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (1)
142private static async Task<WebSocket> Upgrade(HttpContext context)
src\Servers\IIS\IIS\test\testassets\shared\WebSockets\TestStartup.cs (1)
34else if (parameters[0].ParameterType == typeof(HttpContext))
Interop.FunctionalTests (5)
Http3\Http3RequestTests.cs (5)
1521var contexts = new List<HttpContext>(); 1991var requestStartedTcs = new TaskCompletionSource<HttpContext>(TaskCreationOptions.RunContinuationsAsynchronously); 2055var httpContext = await requestStartedTcs.Task.DefaultTimeout(); 2112var requestStartedTcs = new TaskCompletionSource<HttpContext>(TaskCreationOptions.RunContinuationsAsynchronously); 2155var httpContext = await requestStartedTcs.Task.DefaultTimeout();
JwtSample (1)
Startup.cs (1)
77private string GenerateToken(HttpContext httpContext)
Kestrel.SampleApp (2)
ClientCertBufferingFeature.cs (2)
43private readonly HttpContext _context; 45public ClientCertBufferingFeature(ITlsConnectionFeature tlsFeature, HttpContext context)
LocalizationSample (1)
Startup.cs (1)
115private static async System.Threading.Tasks.Task WriteCultureSelectOptions(HttpContext context)
Microsoft.Analyzers.Extra.Tests (1)
AsyncMethodWithoutCancellationTests.cs (1)
163new[] { Assembly.GetAssembly(typeof(HttpContext))! },
Microsoft.AspNetCore.Antiforgery (48)
AntiforgeryMiddleware.cs (2)
16public Task Invoke(HttpContext context) 39public async Task InvokeAwaited(HttpContext context)
IAntiforgery.cs (11)
19/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 25AntiforgeryTokenSet GetAndStoreTokens(HttpContext httpContext); 30/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 33/// Unlike <see cref="GetAndStoreTokens(HttpContext)"/>, this method has no side effect. The caller 37AntiforgeryTokenSet GetTokens(HttpContext httpContext); 43/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 48Task<bool> IsRequestValidAsync(HttpContext httpContext); 53/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 58Task ValidateRequestAsync(HttpContext httpContext); 63/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 64void SetCookieTokenAndHeader(HttpContext httpContext);
IAntiforgeryAdditionalDataProvider.cs (2)
28string GetAdditionalData(HttpContext context); 37bool ValidateAdditionalData(HttpContext context, string additionalData);
Internal\DefaultAntiforgery.cs (16)
40public AntiforgeryTokenSet GetAndStoreTokens(HttpContext httpContext) 77public AntiforgeryTokenSet GetTokens(HttpContext httpContext) 88public async Task<bool> IsRequestValidAsync(HttpContext httpContext) 143public async Task ValidateRequestAsync(HttpContext httpContext) 182private void ValidateTokens(HttpContext httpContext, AntiforgeryTokenSet antiforgeryTokenSet) 209public void SetCookieTokenAndHeader(HttpContext httpContext) 239private void SaveCookieTokenAndHeader(HttpContext httpContext, string cookieToken) 256private void CheckSSLConfig(HttpContext context) 266private static IAntiforgeryFeature GetAntiforgeryFeature(HttpContext httpContext) 278private IAntiforgeryFeature GetCookieTokens(HttpContext httpContext) 322private AntiforgeryToken? GetCookieTokenDoesNotThrow(HttpContext httpContext) 343private IAntiforgeryFeature GetTokensInternal(HttpContext httpContext) 360/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 361private void SetDoNotCacheHeaders(HttpContext httpContext) 430HttpContext httpContext, 451HttpContext httpContext,
Internal\DefaultAntiforgeryAdditionalDataProvider.cs (2)
14public string GetAdditionalData(HttpContext context) 20public bool ValidateAdditionalData(HttpContext context, string additionalData)
Internal\DefaultAntiforgeryTokenGenerator.cs (2)
36HttpContext httpContext, 103HttpContext httpContext,
Internal\DefaultAntiforgeryTokenStore.cs (3)
22public string? GetCookieToken(HttpContext httpContext) 36public async Task<AntiforgeryTokenSet> GetRequestTokensAsync(HttpContext httpContext) 79public void SaveCookieToken(HttpContext httpContext, string token)
Internal\IAntiforgeryTokenGenerator.cs (4)
23/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 26AntiforgeryToken GenerateRequestToken(HttpContext httpContext, AntiforgeryToken cookieToken); 38/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 46HttpContext httpContext,
Internal\IAntiforgeryTokenStore.cs (4)
10string? GetCookieToken(HttpContext httpContext); 15/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 17Task<AntiforgeryTokenSet> GetRequestTokensAsync(HttpContext httpContext); 19void SaveCookieToken(HttpContext httpContext, string token);
src\Shared\HttpExtensions.cs (2)
36internal static Endpoint? GetOriginalEndpoint(HttpContext context) 49internal static void ClearEndpoint(HttpContext context)
Microsoft.AspNetCore.Antiforgery.Test (39)
AntiforgeryMiddlewareTest.cs (2)
19antiforgeryService.Setup(af => af.ValidateRequestAsync(It.IsAny<HttpContext>())).Returns(Task.FromResult(true)); 67antiforgeryService.Setup(af => af.ValidateRequestAsync(It.IsAny<HttpContext>())).Returns(Task.FromResult(true));
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)
AsyncContextHttpContext.cs (2)
36var httpContext = _httpContextAccessor.HttpContext; 49var httpContext = _httpContextAccessor.HttpContext;
AsyncStateHttpContextExtensions.cs (1)
18/// scoped to the lifetime of <see cref="AspNetCore.Http.HttpContext"/> instances.
TypeWrapper.cs (3)
9/// We use this generic type to store values into <see cref="AspNetCore.Http.HttpContext.Features"/>. 12/// <see cref="AspNetCore.Http.HttpContext.Features"/> under type T (by the application or another library), 16/// <typeparam name="T">The type of the value to store into <see cref="AspNetCore.Http.HttpContext.Features"/>.</typeparam>
Microsoft.AspNetCore.Authentication (24)
AuthenticationHandler.cs (4)
31/// Gets or sets the <see cref="HttpContext"/>. 33protected HttpContext Context { get; private set; } = default!; 147public async Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 167/// Initializes the events object, called once per request by <see cref="InitializeAsync(AuthenticationScheme, HttpContext)"/>.
AuthenticationMiddleware.cs (2)
39/// <param name="context">The <see cref="HttpContext"/>.</param> 40public async Task Invoke(HttpContext context)
AuthenticationSchemeOptions.cs (1)
89public Func<HttpContext, string?>? ForwardDefaultSelector { get; set; }
Events\AccessDeniedContext.cs (2)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 20HttpContext context,
Events\BaseContext.cs (2)
19protected BaseContext(HttpContext context, AuthenticationScheme scheme, TOptions options) 43public HttpContext HttpContext { get; }
Events\HandleRequestContext.cs (2)
17/// <param name="context">The <see cref="HttpContext"/>.</param> 21HttpContext context,
Events\PrincipalContext.cs (1)
21protected PrincipalContext(HttpContext context, AuthenticationScheme scheme, TOptions options, AuthenticationProperties? properties)
Events\PropertiesContext.cs (1)
20protected PropertiesContext(HttpContext context, AuthenticationScheme scheme, TOptions options, AuthenticationProperties? properties)
Events\RedirectContext.cs (1)
22HttpContext context,
Events\RemoteAuthenticationContext.cs (1)
22HttpContext context,
Events\RemoteFailureContext.cs (2)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 21HttpContext context,
Events\ResultContext.cs (1)
22protected ResultContext(HttpContext context, AuthenticationScheme scheme, TOptions options)
Events\TicketReceivedContext.cs (2)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 21HttpContext context,
RemoteAuthenticationOptions.cs (1)
169public override CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
RequestPathBaseCookieBuilder.cs (1)
22public override CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
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)"/>.
IAuthenticationHandler.cs (2)
17/// <param name="context">The <see cref="HttpContext"/> context for the current request.</param> 18Task InitializeAsync(AuthenticationScheme scheme, HttpContext context);
IAuthenticationHandlerProvider.cs (2)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 19Task<IAuthenticationHandler?> GetHandlerAsync(HttpContext context, string authenticationScheme);
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);
TokenExtensions.cs (4)
120/// <param name="context">The <see cref="HttpContext"/> context.</param> 123public static Task<string?> GetTokenAsync(this IAuthenticationService auth, HttpContext context, string tokenName) 130/// <param name="context">The <see cref="HttpContext"/> context.</param> 134public static async Task<string?> GetTokenAsync(this IAuthenticationService auth, HttpContext context, string? scheme, string tokenName)
Microsoft.AspNetCore.Authentication.BearerToken (6)
BearerTokenExtensions.cs (4)
20/// Bearer tokens can be obtained by calling <see cref="AuthenticationHttpContextExtensions.SignInAsync(AspNetCore.Http.HttpContext, string?, System.Security.Claims.ClaimsPrincipal)" />. 31/// Bearer tokens can be obtained by calling <see cref="AuthenticationHttpContextExtensions.SignInAsync(AspNetCore.Http.HttpContext, string?, System.Security.Claims.ClaimsPrincipal)" />. 43/// Bearer tokens can be obtained by calling <see cref="AuthenticationHttpContextExtensions.SignInAsync(AspNetCore.Http.HttpContext, string?, System.Security.Claims.ClaimsPrincipal)" />. 55/// Bearer tokens can be obtained by calling <see cref="AuthenticationHttpContextExtensions.SignInAsync(AspNetCore.Http.HttpContext, string?, System.Security.Claims.ClaimsPrincipal)" />.
BearerTokenHandler.cs (1)
83private static JsonTypeInfo<AccessTokenResponse> ResolveAccessTokenJsonTypeInfo(HttpContext httpContext)
MessageReceivedContext.cs (1)
18HttpContext context,
Microsoft.AspNetCore.Authentication.Certificate (9)
CertificateValidationCache.cs (2)
41public AuthenticateResult? Get(HttpContext context, X509Certificate2 certificate) 50public void Put(HttpContext context, X509Certificate2 certificate, AuthenticateResult result)
Events\CertificateAuthenticationFailedContext.cs (1)
20HttpContext context,
Events\CertificateChallengeContext.cs (1)
21HttpContext context,
Events\CertificateValidatedContext.cs (1)
21HttpContext context,
ICertificateValidationCache.cs (4)
17/// <param name="context">The <see cref="HttpContext"/>.</param> 20AuthenticateResult? Get(HttpContext context, X509Certificate2 certificate); 25/// <param name="context">The <see cref="HttpContext"/>.</param> 28void Put(HttpContext context, X509Certificate2 certificate, AuthenticateResult result);
Microsoft.AspNetCore.Authentication.Cookies (19)
CookieSignedInContext.cs (1)
23HttpContext context,
CookieSigningInContext.cs (1)
24HttpContext context,
CookieSigningOutContext.cs (1)
22HttpContext context,
CookieSlidingExpirationContext.cs (1)
22public CookieSlidingExpirationContext(HttpContext context, AuthenticationScheme scheme, CookieAuthenticationOptions options,
CookieValidatePrincipalContext.cs (1)
21public CookieValidatePrincipalContext(HttpContext context, AuthenticationScheme scheme, CookieAuthenticationOptions options, AuthenticationTicket ticket)
ICookieManager.cs (3)
20string? GetRequestCookie(HttpContext context, string key); 29void AppendResponseCookie(HttpContext context, string key, string? value, CookieOptions options); 37void DeleteCookie(HttpContext context, string key, CookieOptions options);
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 (21)
AuthenticationHandlerProvider.cs (1)
37public async Task<IAuthenticationHandler?> GetHandlerAsync(HttpContext context, string authenticationScheme)
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)
56/// <param name="context">The <see cref="HttpContext"/>.</param> 59public virtual async Task<AuthenticateResult> AuthenticateAsync(HttpContext context, string? scheme) 103/// <param name="context">The <see cref="HttpContext"/>.</param> 107public virtual async Task ChallengeAsync(HttpContext context, string? scheme, AuthenticationProperties? properties) 131/// <param name="context">The <see cref="HttpContext"/>.</param> 135public virtual async Task ForbidAsync(HttpContext context, string? scheme, AuthenticationProperties? properties) 159/// <param name="context">The <see cref="HttpContext"/>.</param> 164public virtual async Task SignInAsync(HttpContext context, string? scheme, ClaimsPrincipal principal, AuthenticationProperties? properties) 208/// <param name="context">The <see cref="HttpContext"/>.</param> 212public virtual async Task SignOutAsync(HttpContext context, string? scheme, AuthenticationProperties? properties)
Microsoft.AspNetCore.Authentication.Core.Test (7)
AuthenticationSchemeProviderTests.cs (1)
273public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
AuthenticationServiceTests.cs (5)
274public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 297public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 330public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 363public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 401public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
TokenExtensionTests.cs (1)
178public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
Microsoft.AspNetCore.Authentication.JwtBearer (5)
AuthenticationFailedContext.cs (1)
18HttpContext context,
ForbiddenContext.cs (1)
18HttpContext context,
JwtBearerChallengeContext.cs (1)
18HttpContext context,
MessageReceivedContext.cs (1)
18HttpContext context,
TokenValidatedContext.cs (1)
19HttpContext context,
Microsoft.AspNetCore.Authentication.Negotiate (4)
Events\AuthenticatedContext.cs (1)
18HttpContext context,
Events\AuthenticationFailedContext.cs (1)
18HttpContext context,
Events\ChallengeContext.cs (1)
18HttpContext context,
Events\LdapContext.cs (1)
18HttpContext context,
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)
39var result = await SendAsync(server, "/Anonymous1", new TestConnection()); 49var result = await SendAsync(server, "/Anonymous2", connection: null, http2: true); 59var result = await SendAsync(server, "/Authenticate", new TestConnection()); 70var result = await SendAsync(server, "/Authenticate", connection: null, http2: true); 81var result = await SendAsync(server, "/404", new TestConnection(), "Negotiate ClientNtlmBlob1"); 163var result = await SendAsync(server, "/Authenticate", testConnection); 190var result = await SendAsync(server, "/Authenticate", testConnection); 288var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientNtlmBlob2"); 299var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate CredentialError"); 310var result = await SendAsync(server, "/404", testConnection, "Negotiate ClientError"); 327var result = await SendAsync(server, "/AuthenticateAndRetrieveRBACClaims", testConnection, "Negotiate ClientKerberosBlob"); 335var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob"); 348var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob1"); 355var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientKerberosBlob2"); 368var result = await SendAsync(server, "/404", testConnection, "Negotiate ClientNtlmBlob1"); 375var result = await SendAsync(server, "/Authenticate", testConnection, "Negotiate ClientNtlmBlob2"); 480private static Task<HttpContext> SendAsync(TestServer server, string path, TestConnection connection, string authorizationHeader = null, bool http2 = false)
Microsoft.AspNetCore.Authentication.OAuth (1)
Events\OAuthCreatingTicketContext.cs (1)
31HttpContext context,
Microsoft.AspNetCore.Authentication.OpenIdConnect (10)
Events\AuthenticationFailedContext.cs (1)
18public AuthenticationFailedContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options)
Events\AuthorizationCodeReceivedContext.cs (1)
20HttpContext context,
Events\MessageReceivedContext.cs (1)
19HttpContext context,
Events\PushedAuthorizationContext.cs (1)
19public PushedAuthorizationContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options, OpenIdConnectMessage parRequest, AuthenticationProperties properties)
Events\RedirectContext.cs (1)
21HttpContext context,
Events\RemoteSignoutContext.cs (1)
18public RemoteSignOutContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options, OpenIdConnectMessage? message)
Events\TokenResponseReceivedContext.cs (1)
18public TokenResponseReceivedContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options, ClaimsPrincipal user, AuthenticationProperties properties)
Events\TokenValidatedContext.cs (1)
20public TokenValidatedContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options, ClaimsPrincipal principal, AuthenticationProperties properties)
Events\UserInformationReceivedContext.cs (1)
20public UserInformationReceivedContext(HttpContext context, AuthenticationScheme scheme, OpenIdConnectOptions options, ClaimsPrincipal principal, AuthenticationProperties properties)
OpenIdConnectOptions.cs (1)
352public override CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
Microsoft.AspNetCore.Authentication.Test (34)
AuthenticationMiddlewareTests.cs (15)
64authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), It.IsAny<string>())) 70var context = GetHttpContext(authenticationService: authenticationService.Object); 87authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), It.IsAny<string>())) 93var context = GetHttpContext(authenticationService: authenticationService.Object); 107authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), It.IsAny<string>())) 113var context = GetHttpContext(authenticationService: authenticationService.Object); 133authenticationService.Setup(s => s.AuthenticateAsync(It.IsAny<HttpContext>(), It.IsAny<string>())) 139var context = GetHttpContext(authenticationService: authenticationService.Object); 200private HttpContext GetHttpContext( 242private HttpContext _context; 271public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 290private HttpContext _context; 312public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 331private HttpContext _context; 353public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
CertificateTests.cs (1)
790Func<HttpContext, bool> handler = null,
CookieTests.cs (5)
105private static Task SignInAsAlice(HttpContext context) 114private static Task SignInAsWrong(HttpContext context) 121private Task SignOutAsWrong(HttpContext context) 1793private Task<IHost> CreateHost(Action<CookieAuthenticationOptions> configureOptions, Func<HttpContext, Task> testpath = null, Uri baseAddress = null, bool claimsTransform = false) 1807private static async Task<IHost> CreateHostWithServices(Action<IServiceCollection> configureServices, Func<HttpContext, Task> testpath = null, Uri baseAddress = null)
FacebookTests.cs (1)
455private static async Task<IHost> CreateHost(Action<IApplicationBuilder> configure, Action<IServiceCollection> configureServices, Func<HttpContext, Task<bool>> handler)
GoogleTests.cs (1)
1144private static async Task<IHost> CreateHost(Action<GoogleOptions> configureOptions, Func<HttpContext, Task> testpath = null)
JwtBearerTests.cs (1)
1159private static async Task<IHost> CreateHost(Action<JwtBearerOptions> options = null, Func<HttpContext, Func<Task>, Task> handlerBeforeAuth = null)
JwtBearerTests_Handler.cs (1)
1218private static async Task<IHost> CreateHost(Action<JwtBearerOptions> options = null, Func<HttpContext, Func<Task>, Task> handlerBeforeAuth = null)
OAuthTests.cs (1)
511private static async Task<IHost> CreateHost(Action<IServiceCollection> configureServices, Func<HttpContext, Task<bool>> handler = null)
OpenIdConnect\TestServerBuilder.cs (1)
61Func<HttpContext, Task> handler,
OpenIdConnect\TestSettings.cs (1)
47public TestServer CreateTestServer(AuthenticationProperties properties = null, Func<HttpContext, Task> handler = null) => TestServerBuilder.CreateServer(_configureOptions, handler: handler, properties: properties);
PolicyTests.cs (2)
392public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 442public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
RemoteAuthenticationTests.cs (2)
18private Task<IHost> CreateHost(Action<TOptions> configureOptions, Func<HttpContext, Task> testpath = null, bool isDefault = true) 34protected virtual async Task<IHost> CreateHostWithServices(Action<IServiceCollection> configureServices, Func<HttpContext, Task> testpath = null)
TestHandlers.cs (1)
89public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
TwitterTests.cs (1)
535private static async Task<IHost> CreateHost(Action<TwitterOptions> options, Func<HttpContext, Task<bool>> handler = null)
Microsoft.AspNetCore.Authentication.Twitter (2)
TwitterCreatingTicketContext.cs (1)
29HttpContext context,
TwitterOptions.cs (1)
120public override CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
Microsoft.AspNetCore.Authentication.WsFederation (6)
AuthenticationFailedContext.cs (1)
20public AuthenticationFailedContext(HttpContext context, AuthenticationScheme scheme, WsFederationOptions options)
MessageReceivedContext.cs (1)
22HttpContext context,
RedirectContext.cs (1)
23HttpContext context,
RemoteSignoutContext.cs (1)
21public RemoteSignOutContext(HttpContext context, AuthenticationScheme scheme, WsFederationOptions options, WsFederationMessage message)
SecurityTokenReceivedContext.cs (1)
17public SecurityTokenReceivedContext(HttpContext context, AuthenticationScheme scheme, WsFederationOptions options, AuthenticationProperties properties)
SecurityTokenValidatedContext.cs (1)
19public SecurityTokenValidatedContext(HttpContext context, AuthenticationScheme scheme, WsFederationOptions options, ClaimsPrincipal principal, AuthenticationProperties properties)
Microsoft.AspNetCore.Authorization.Policy (19)
AuthorizationMiddleware.cs (2)
92/// <param name="context">The <see cref="HttpContext"/>.</param> 93public async Task Invoke(HttpContext context)
AuthorizationMiddlewareResultHandler.cs (1)
15public Task HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
IAuthorizationMiddlewareResultHandler.cs (2)
20/// <param name="context">The <see cref="HttpContext"/>.</param> 23Task HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult);
IPolicyEvaluator.cs (6)
17/// <see cref="ClaimsPrincipal"/> to <see cref="HttpContext.User"/>. If no schemes are set, this is a no-op. 20/// <param name="context">The <see cref="HttpContext"/>.</param> 22Task<AuthenticateResult> AuthenticateAsync(AuthorizationPolicy policy, HttpContext context); 28/// <param name="authenticationResult">The result of a call to <see cref="AuthenticateAsync(AuthorizationPolicy, HttpContext)"/>.</param> 29/// <param name="context">The <see cref="HttpContext"/>.</param> 37Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource);
PolicyAuthorizationResult.cs (1)
7/// The result of <see cref="IPolicyEvaluator.AuthorizeAsync(AuthorizationPolicy, Authentication.AuthenticateResult, Http.HttpContext, object?)"/>.
PolicyEvaluator.cs (7)
29/// <see cref="ClaimsPrincipal"/> to <see cref="HttpContext.User"/>. If no schemes are set, this is a no-op. 32/// <param name="context">The <see cref="HttpContext"/>.</param> 34public virtual async Task<AuthenticateResult> AuthenticateAsync(AuthorizationPolicy policy, HttpContext context) 73static AuthenticateResult DefaultAuthenticateResult(HttpContext context) 85/// <param name="authenticationResult">The result of a call to <see cref="AuthenticateAsync(AuthorizationPolicy, HttpContext)"/>.</param> 86/// <param name="context">The <see cref="HttpContext"/>.</param> 94public virtual async Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object? resource)
Microsoft.AspNetCore.Authorization.Test (71)
AuthorizationMiddlewareResultHandlerTests.cs (11)
18var httpContext = CreateHttpContext(); 25requestDelegate.Verify(next => next(It.IsAny<HttpContext>()), Times.Once); 32var httpContext = CreateHttpContext(); 39requestDelegate.Verify(next => next(It.IsAny<HttpContext>()), Times.Never); 46var httpContext = CreateHttpContext(); 53requestDelegate.Verify(next => next(It.IsAny<HttpContext>()), Times.Never); 61var httpContext = CreateHttpContext(authenticationServiceMock.Object); 85var httpContext = CreateHttpContext(authenticationServiceMock.Object); 100var httpContext = CreateHttpContext(authenticationServiceMock.Object); 124var httpContext = CreateHttpContext(authenticationServiceMock.Object); 134private HttpContext CreateHttpContext(IAuthenticationService authenticationService = null)
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 (59)
Assets\ImportMap.cs (1)
22[CascadingParameter] public HttpContext? HttpContext { get; set; } = null;
Builder\OpaqueRedirection.cs (3)
42public static string CreateProtectedRedirectionUrl(HttpContext httpContext, string destinationUrl) 66private static Task OpaqueRedirect(HttpContext httpContext) 96private static ITimeLimitedDataProtector CreateProtector(HttpContext httpContext)
Builder\RazorComponentsEndpointHttpContextExtensions.cs (3)
16/// Extensions to <see cref="HttpContext"/> for Razor component applications. 27/// <param name="context">The <see cref="HttpContext"/>.</param> 29public static bool AcceptsInteractiveRouting(this HttpContext context)
Builder\ResourceCollectionUrlEndpoint.cs (9)
182public async Task FingerprintedGzipContent(HttpContext context) 190public async Task FingerprintedContent(HttpContext context) 197public async Task Content(HttpContext context) 204public async Task GzipContent(HttpContext context) 212private void WriteEncodingHeaders(HttpContext context) 219private void WriteNoEncodingHeaders(HttpContext context) 224private static void WriteFingerprintHeaders(HttpContext context) 229private static void WriteNonFingerprintedHeaders(HttpContext context) 234private static void WriteCommonHeaders(HttpContext context, byte[] contents)
DependencyInjection\IComponentPrerenderer.cs (5)
19/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 25HttpContext httpContext, 33/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 37HttpContext httpContext, 41/// Gets a <see cref="Dispatcher"/> that should be used for calls to <see cref="PrerenderComponentAsync(HttpContext, Type, IComponentRenderMode, ParameterView)"/>.
Forms\EndpointAntiforgeryStateProvider.cs (2)
12private HttpContext? _context; 14internal void SetRequestContext(HttpContext context)
IRazorComponentEndpointInvoker.cs (2)
24/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 27Task Render(HttpContext context);
RazorComponentEndpointInvoker.cs (5)
31public Task Render(HttpContext context) 38private async Task RenderComponentCore(HttpContext context) 49var endpoint = context.GetEndpoint() ?? throw new InvalidOperationException($"An endpoint must be set on the '{nameof(HttpContext)}'."); 160private async Task<RequestValidationState> ValidateRequestAsync(HttpContext context, IAntiforgery? antiforgery) 242private static string? GetFormHandler(HttpContext context, out bool isBadRequest)
Rendering\EndpointHtmlRenderer.cs (6)
43private HttpContext _httpContext = default!; // Always set at the start of an inbound call 59internal HttpContext? HttpContext => _httpContext; 61private void SetHttpContext(HttpContext httpContext) 74HttpContext httpContext, 130private static void InitializeResourceCollection(HttpContext httpContext) 154private static ResourceAssetCollection? GetResourceCollection(HttpContext httpContext) => httpContext.GetEndpoint()?.Metadata.GetMetadata<ResourceAssetCollection>();
Rendering\EndpointHtmlRenderer.Prerendering.cs (6)
80public static void MarkAsAllowingEnhancedNavigation(HttpContext context) 86HttpContext httpContext, 95HttpContext httpContext, 138HttpContext httpContext, 194public static ValueTask<PrerenderedComponentHtmlContent> HandleNavigationException(HttpContext httpContext, NavigationException navigationException) 238internal static ServerComponentInvocationSequence GetOrCreateInvocationId(HttpContext httpContext)
Rendering\EndpointHtmlRenderer.PrerenderingState.cs (4)
19public async ValueTask<IHtmlContent> PrerenderPersistedStateAsync(HttpContext httpContext) 111public async ValueTask<IHtmlContent> PrerenderPersistedStateAsync(HttpContext httpContext, PersistedStateSerializationMode serializationMode) 158internal static void UpdateSaveStateRenderMode(HttpContext httpContext, IComponentRenderMode? mode) 194internal static InvokedRenderModes.Mode GetPersistStateRenderMode(HttpContext httpContext)
Rendering\EndpointHtmlRenderer.Streaming.cs (6)
26public void InitializeStreamingRenderingFraming(HttpContext httpContext, bool isErrorHandler) 43public async Task SendStreamingUpdatesAsync(HttpContext httpContext, Task untilTaskCompleted, TextWriter writer) 94internal void EmitInitializersIfNecessary(HttpContext httpContext, TextWriter writer) 204internal static bool ShouldShowDetailedErrors(HttpContext httpContext) 212private static void HandleExceptionAfterResponseStarted(HttpContext httpContext, TextWriter writer, Exception exception) 226private static void HandleNavigationAfterResponseStarted(TextWriter writer, HttpContext httpContext, string destinationUrl)
Rendering\SSRRenderModeBoundary.cs (3)
35HttpContext httpContext, 52private static void AssertRenderModeIsConfigured(HttpContext httpContext, Type componentType, IComponentRenderMode renderMode) 155public ComponentMarker ToMarker(HttpContext httpContext, int sequence, object? componentKey)
Results\RazorComponentResult.cs (2)
97/// <param name="httpContext">An <see cref="HttpContext" /> associated with the current request.</param > 99public Task ExecuteAsync(HttpContext httpContext)
Results\RazorComponentResultExecutor.cs (2)
22public static Task ExecuteAsync(HttpContext httpContext, RazorComponentResult result) 42HttpContext httpContext,
Microsoft.AspNetCore.Components.Endpoints.Tests (38)
EndpointHtmlRendererTest.cs (37)
53var httpContext = GetHttpContext(); 76var httpContext = GetHttpContext(); 114var httpContext = GetHttpContext(); 151var httpContext = GetHttpContext(); 186var httpContext = GetHttpContext(); 235var httpContext = GetHttpContext(); 283var httpContext = GetHttpContext(); 299var httpContext = GetHttpContext(); 331var httpContext = GetHttpContext(); 376var httpContext = GetHttpContext(); 392var httpContext = GetHttpContext(); 434var httpContext = GetHttpContext(); 449var httpContext = GetHttpContext(); 488var httpContext = GetHttpContext(); 527var httpContext = GetHttpContext(); 578var httpContext = GetHttpContext(); 629var httpContext = GetHttpContext(); 645var httpContext = GetHttpContext(); 674var httpContext = GetHttpContext(context); 694var httpContext = GetHttpContext(); 714var httpContext = GetHttpContext(); 734var httpContext = GetHttpContext(); 766var httpContext = GetHttpContext(ctx); 794var httpContext = GetHttpContext(ctx); 815var httpContext = GetHttpContext(); 1052var httpContext = GetHttpContext(); 1156var httpContext = GetHttpContext(); 1188var httpContext = GetHttpContext(); 1209var httpContext = GetHttpContext(); 1239var httpContext = GetHttpContext(); 1267var httpContext = GetHttpContext(); 1321var httpContext = GetHttpContext(); 1359var httpContext = GetHttpContext(); 1389var httpContext = GetHttpContext(); 1454var httpContext = GetHttpContext(); 1653private HttpContext GetHttpContext(HttpContext context = null)
SSRRenderModeBoundaryTest.cs (1)
84private static void PrepareEndpoint(HttpContext httpContext, params IComponentRenderMode[] configuredModes)
Microsoft.AspNetCore.Components.Server (6)
Builder\ServerComponentsEndpointOptions.cs (1)
55public Func<HttpContext, WebSocketAcceptContext, Task>? ConfigureWebSocketAcceptContext { get; set; }
CircuitDisconnectMiddleware.cs (2)
32public async Task Invoke(HttpContext context) 52private async Task<CircuitId?> GetCircuitIdAsync(HttpContext context)
CircuitJavaScriptInitializationMiddleware.cs (1)
21public async Task InvokeAsync(HttpContext context)
DependencyInjection\ServerRazorComponentsBuilderExtensions.cs (2)
163HttpContext httpContext, 164Func<HttpContext, WebSocketAcceptContext, Task>? configureConnection,
Microsoft.AspNetCore.Components.WebAssembly.Server (8)
ContentEncodingNegotiator.cs (4)
33public Task InvokeAsync(HttpContext context) 39private void NegotiateEncoding(HttpContext context) 97StringSegment PickPreferredEncoding(HttpContext context, StringSegment selectedEncoding, StringWithQualityHeaderValue encoding) 116private bool ResourceExists(HttpContext context, string extension) =>
TargetPickerUi.cs (4)
46/// <param name="context">The <see cref="HttpContext"/>.</param> 48public async Task DisplayFirefox(HttpContext context) 261/// <param name="context">The <see cref="HttpContext"/>.</param> 263public async Task Display(HttpContext context)
Microsoft.AspNetCore.ConcurrencyLimiter (2)
ConcurrencyLimiterMiddleware.cs (2)
44/// <param name="context">The <see cref="HttpContext"/>.</param> 46public async Task Invoke(HttpContext context)
Microsoft.AspNetCore.ConcurrencyLimiter.Microbenchmarks (5)
QueueEmptyOverhead.cs (2)
66private static async Task YieldsThread(HttpContext context) 71private static Task CompletesImmediately(HttpContext context)
QueueFullOverhead.cs (1)
45private async Task IncrementAndCheck(HttpContext context)
QueueRequestsOverwritten.cs (2)
45private async Task IncrementRejections(HttpContext context) 55private async Task WaitForever(HttpContext context)
Microsoft.AspNetCore.CookiePolicy (13)
AppendCookieContext.cs (4)
17/// <param name="context">The request <see cref="HttpContext"/>.</param> 21public AppendCookieContext(HttpContext context, CookieOptions options, string name, string value) 30/// Gets the <see cref="HttpContext"/>. 32public HttpContext Context { get; }
CookiePolicyMiddleware.cs (2)
62/// <param name="context">The <see cref="HttpContext" />.</param> 63public Task Invoke(HttpContext context)
CookiePolicyOptions.cs (1)
70public Func<HttpContext, bool>? CheckConsentNeeded { get; set; }
DeleteCookieContext.cs (4)
17/// <param name="context">The request <see cref="HttpContext"/>.</param> 20public DeleteCookieContext(HttpContext context, CookieOptions options, string name) 28/// Gets the <see cref="HttpContext"/>. 30public HttpContext Context { get; }
ResponseCookiesWrapper.cs (2)
19public ResponseCookiesWrapper(HttpContext context, CookiePolicyOptions options, IResponseCookiesFeature feature, ILogger logger) 27private HttpContext Context { get; }
Microsoft.AspNetCore.CookiePolicy.Test (40)
CookieChunkingTests.cs (13)
14HttpContext context = new DefaultHttpContext(); 26HttpContext context = new DefaultHttpContext(); 49HttpContext context = new DefaultHttpContext(); 67HttpContext context = new DefaultHttpContext(); 86HttpContext context = new DefaultHttpContext(); 117HttpContext context = new DefaultHttpContext(); 148HttpContext context = new DefaultHttpContext(); 169HttpContext context = new DefaultHttpContext(); 189HttpContext context = new DefaultHttpContext(); 210HttpContext context = new DefaultHttpContext(); 232HttpContext context = new DefaultHttpContext(); 249HttpContext context = new DefaultHttpContext(); 268HttpContext httpContext = new DefaultHttpContext();
CookieConsentTests.cs (23)
21var httpContext = await RunTestAsync(options => { }, requestContext => { }, context => 36var httpContext = await RunTestAsync(options => 55var httpContext = await RunTestAsync(options => 74var httpContext = await RunTestAsync(options => 100var httpContext = await RunTestAsync(options => 119var httpContext = await RunTestAsync(options => 149var httpContext = await RunTestAsync(options => 172var httpContext = await RunTestAsync(options => 195var httpContext = await RunTestAsync(options => 236var httpContext = await RunTestAsync(options => 280var httpContext = await RunTestAsync(options => 311var httpContext = await RunTestAsync(options => 344var httpContext = await RunTestAsync(options => 372var httpContext = await RunTestAsync(options => 415var httpContext = await RunTestAsync(options => 457var httpContext = await RunTestAsync(options => 495var httpContext = await RunTestAsync(options => 522var httpContext = await RunTestAsync(options => 550var httpContext = await RunTestAsync(options => 594var httpContext = await RunTestAsync(options => 647var httpContext = await RunTestAsync(options => 702private async Task<HttpContext> RunTestAsync(Action<CookiePolicyOptions> configureOptions, Action<HttpContext> configureRequest, RequestDelegate handleRequest)
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)
Infrastructure\CorsMiddleware.cs (4)
89public Task Invoke(HttpContext context, ICorsPolicyProvider corsPolicyProvider) 161async Task InvokeCoreAwaited(HttpContext context, Task<CorsPolicy?> policyTask) 168private Task EvaluateAndApplyPolicy(HttpContext context, CorsPolicy? corsPolicy) 195var (middleware, context, result) = (Tuple<CorsMiddleware, HttpContext, CorsResult>)state;
Infrastructure\CorsService.cs (5)
44public CorsResult EvaluatePolicy(HttpContext context, string policyName) 58public CorsResult EvaluatePolicy(HttpContext context, CorsPolicy policy) 97private static void PopulateResult(HttpContext context, CorsPolicy policy, CorsResult result) 135public virtual void EvaluateRequest(HttpContext context, CorsPolicy policy, CorsResult result) 146public virtual void EvaluatePreflightRequest(HttpContext context, CorsPolicy policy, CorsResult result)
Infrastructure\DefaultCorsPolicyProvider.cs (1)
25public Task<CorsPolicy?> GetPolicyAsync(HttpContext context, string? policyName)
Infrastructure\ICorsPolicyProvider.cs (3)
9/// A type which can provide a <see cref="CorsPolicy"/> for a particular <see cref="HttpContext"/>. 16/// <param name="context">The <see cref="HttpContext"/> associated with this call.</param> 19Task<CorsPolicy?> GetPolicyAsync(HttpContext context, string? policyName);
Infrastructure\ICorsService.cs (3)
9/// A type which can evaluate a policy for a particular <see cref="HttpContext"/>. 16/// <param name="context">The <see cref="HttpContext"/> associated with the call.</param> 20CorsResult EvaluatePolicy(HttpContext context, CorsPolicy policy);
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 (31)
DeveloperExceptionPage\DeveloperExceptionPageMiddleware.cs (1)
53public Task Invoke(HttpContext context)
DeveloperExceptionPage\DeveloperExceptionPageMiddlewareImpl.cs (7)
86var httpContext = errorContext.HttpContext; 106public async Task Invoke(HttpContext context) 201var httpContext = errorContext.HttpContext; 221var httpContext = errorContext.HttpContext; 251private ProblemDetails CreateProblemDetails(ErrorContext errorContext, HttpContext httpContext) 275HttpContext context, 336private Task DisplayRuntimeException(HttpContext context, Exception ex)
DiagnosticsTelemetry.cs (1)
12public static void ReportUnhandledException(ILogger logger, HttpContext context, Exception ex)
ExceptionHandler\ExceptionHandlerMiddleware.cs (2)
46/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 47public Task Invoke(HttpContext context)
ExceptionHandler\ExceptionHandlerMiddlewareImpl.cs (5)
70/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 71public Task Invoke(HttpContext context) 93static async Task Awaited(ExceptionHandlerMiddlewareImpl middleware, HttpContext context, Task task) 113private async Task HandleException(HttpContext context, ExceptionDispatchInfo edi) 244private static void ClearHttpContext(HttpContext context)
ExceptionHandler\ExceptionHandlerOptions.cs (1)
22/// replace it on <see cref="HttpContext.RequestServices"/> when re-executing the request to handle an error.
ExceptionHandler\IExceptionHandler.cs (2)
18/// <param name="httpContext">The <see cref="HttpContext"/> for the request.</param> 26ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken);
src\Shared\Diagnostics\BaseView.cs (2)
25protected HttpContext Context { get; private set; } = default!; 61public async Task ExecuteAsync(HttpContext context)
src\Shared\HttpExtensions.cs (2)
36internal static Endpoint? GetOriginalEndpoint(HttpContext context) 49internal static void ClearEndpoint(HttpContext context)
src\Shared\RazorViews\BaseView.cs (2)
28protected HttpContext Context { get; private set; } = default!; 80public async Task ExecuteAsync(HttpContext context)
StatusCodePage\StatusCodeContext.cs (2)
20public StatusCodeContext(HttpContext context, StatusCodePagesOptions options, RequestDelegate next) 30public HttpContext HttpContext { get; private set; }
StatusCodePage\StatusCodePagesMiddleware.cs (2)
37/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 39public async Task Invoke(HttpContext context)
WelcomePage\WelcomePageMiddleware.cs (2)
36/// <param name="context">The <see cref="HttpContext"/>.</param> 38public Task Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.Abstractions (2)
ErrorContext.cs (2)
18public ErrorContext(HttpContext httpContext, Exception exception) 27public HttpContext HttpContext { get; }
Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore (9)
DatabaseErrorPageMiddleware.cs (1)
75public virtual async Task Invoke(HttpContext httpContext)
HttpContextDatabaseContextDetailsExtensions.cs (1)
19public static async ValueTask<DatabaseContextDetails?> GetContextDetailsAsync(this HttpContext httpContext, Type dbcontextType, ILogger logger)
MigrationsEndPointMiddleware.cs (3)
51public virtual Task Invoke(HttpContext context) 63private async Task InvokeCore(HttpContext context) 95private static async Task<DbContext?> GetDbContext(HttpContext context, ILogger logger)
src\Shared\Diagnostics\BaseView.cs (2)
25protected HttpContext Context { get; private set; } = default!; 61public async Task ExecuteAsync(HttpContext context)
src\Shared\RazorViews\BaseView.cs (2)
28protected HttpContext Context { get; private set; } = default!; 80public async Task ExecuteAsync(HttpContext context)
Microsoft.AspNetCore.Diagnostics.HealthChecks (4)
Builder\HealthCheckApplicationBuilderExtensions.cs (1)
210Func<HttpContext, bool> predicate = c =>
HealthCheckMiddleware.cs (1)
41public async Task InvokeAsync(HttpContext httpContext)
HealthCheckOptions.cs (1)
71public Func<HttpContext, HealthReport, Task> ResponseWriter { get; set; } = HealthCheckResponseWriters.WriteMinimalPlaintext;
HealthCheckResponseWriters.cs (1)
16public static Task WriteMinimalPlaintext(HttpContext httpContext, HealthReport result)
Microsoft.AspNetCore.Diagnostics.Middleware (16)
Latency\AddServerTimingHeaderMiddleware.cs (4)
29/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 31public Task InvokeAsync(HttpContext context) 35var httpContext = (HttpContext)ctx;
Latency\CapturePipelineEntryMiddleware.cs (1)
26public async Task InvokeAsync(HttpContext context)
Latency\CapturePipelineExitMiddleware.cs (1)
29public async Task InvokeAsync(HttpContext context)
Latency\CaptureResponseTimeMiddleware.cs (2)
32/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 34public Task InvokeAsync(HttpContext context)
Latency\RequestLatencyTelemetryMiddleware.cs (4)
55/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 57public Task InvokeAsync(HttpContext context) 65var httpContext = (HttpContext)ctx;
Logging\HttpLoggingRedactionInterceptor.cs (2)
66var context = logContext.HttpContext; 137var context = logContext.HttpContext;
Logging\IHttpLogEnricher.cs (2)
23/// <param name="httpContext"><see cref="HttpContext"/> object associated with the incoming HTTP request.</param> 24void Enrich(IEnrichmentTagCollector collector, HttpContext httpContext);
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (28)
Latency\RequestLatencyTelemetryMiddlewareTests.cs (7)
37var httpContextMock = GetHttpContext(lc.Object); 67var httpContextMock = GetHttpContext(lc.Object); 95var httpContextMock = GetHttpContext(lc.Object); 126var httpContextMock = GetHttpContext(lc.Object); 143var httpContextMock = GetHttpContext(lc.Object); 177var httpContextMock = GetHttpContext(lc.Object); 214private static HttpContext GetHttpContext(ILatencyContext latencyContext)
Logging\AcceptanceTests.cs (1)
758public void Enrich(IEnrichmentTagCollector collector, HttpContext httpContext) => throw new InvalidOperationException();
Logging\CustomHttpLogEnricher.cs (1)
19public void Enrich(IEnrichmentTagCollector collector, HttpContext httpContext)
Logging\HttpUtilityExtensionsTests.cs (3)
48HttpContext context = new DefaultHttpContext(); 59HttpContext context = new DefaultHttpContext(); 77HttpContext context = new DefaultHttpContext();
Logging\IncomingHttpRouteUtilityTests.cs (11)
52HttpContext context = new DefaultHttpContext(); 90HttpContext context = new DefaultHttpContext(); 130HttpContext context = new DefaultHttpContext(); 172HttpContext context = new DefaultHttpContext(); 214HttpContext context = new DefaultHttpContext(); 261HttpContext context = new DefaultHttpContext(); 302HttpContext context = new DefaultHttpContext(); 350HttpContext context = new DefaultHttpContext(); 395HttpContext context = new DefaultHttpContext(); 433HttpContext context = new DefaultHttpContext(); 456HttpContext context = new DefaultHttpContext();
Logging\RequestHeadersEnricherTests.cs (4)
46var httpContextMock = new Mock<HttpContext>(MockBehavior.Strict); 204accessorMock.SetupGet(r => r.HttpContext).Returns((HttpContext)null!); 232var httpContextMock = new Mock<HttpContext>(MockBehavior.Strict); 255var httpContextMock = new Mock<HttpContext>(MockBehavior.Strict);
Logging\TestHttpLogEnricher.cs (1)
19public void Enrich(IEnrichmentTagCollector collector, HttpContext httpContext)
Microsoft.AspNetCore.Diagnostics.Tests (12)
ExceptionHandlerMiddlewareTest.cs (12)
84var httpContext = CreateHttpContext(); 105var httpContext = CreateHttpContext(); 129var httpContext = CreateHttpContext(); 154var httpContext = CreateHttpContext(); 179var httpContext = CreateHttpContext(); 210var httpContext = CreateHttpContext(); 233var httpContext = CreateHttpContext(); 254var httpContext = CreateHttpContext(); 281var httpContext = CreateHttpContext(); 428var httpContext = CreateHttpContext(); 474public ValueTask<bool> TryHandleAsync(HttpContext httpContext, Exception exception, CancellationToken cancellationToken) 481private HttpContext CreateHttpContext()
Microsoft.AspNetCore.Grpc.JsonTranscoding (21)
Internal\CallHandlers\ServerCallHandlerBase.cs (2)
37public Task HandleCallAsync(HttpContext httpContext) 80protected abstract Task HandleCallAsyncCore(HttpContext httpContext, JsonTranscodingServerCallContext serverCallContext);
Internal\CallHandlers\ServerStreamingServerCallHandler.cs (1)
27protected override async Task HandleCallAsyncCore(HttpContext httpContext, JsonTranscodingServerCallContext serverCallContext)
Internal\CallHandlers\UnaryServerCallHandler.cs (1)
29protected override async Task HandleCallAsyncCore(HttpContext httpContext, JsonTranscodingServerCallContext serverCallContext)
Internal\JsonTranscodingRouteAdapter.cs (3)
45public List<Action<HttpContext>> RewriteVariableActions { get; } 47private JsonTranscodingRouteAdapter(HttpRoutePattern httpRoutePattern, string resolvedRoutePattern, List<Action<HttpContext>> rewriteVariableActions) 56var rewriteActions = new List<Action<HttpContext>>();
Internal\JsonTranscodingServerCallContext.cs (2)
26public HttpContext HttpContext { get; } 40public JsonTranscodingServerCallContext(HttpContext httpContext, MethodOptions options, IMethod method, CallHandlerDescriptorInfo descriptorInfo, ILogger logger)
src\Grpc\JsonTranscoding\src\Shared\Server\ClientStreamingServerMethodInvoker.cs (3)
84/// Invoke the client streaming method with the specified <see cref="HttpContext"/>. 86/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 91public async Task<TResponse> Invoke(HttpContext httpContext, ServerCallContext serverCallContext, IAsyncStreamReader<TRequest> requestStream)
src\Grpc\JsonTranscoding\src\Shared\Server\DuplexStreamingServerMethodInvoker.cs (3)
85/// Invoke the duplex streaming method with the specified <see cref="HttpContext"/>. 87/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 92public async Task Invoke(HttpContext httpContext, ServerCallContext serverCallContext, IAsyncStreamReader<TRequest> requestStream, IServerStreamWriter<TResponse> responseStream)
src\Grpc\JsonTranscoding\src\Shared\Server\ServerStreamingServerMethodInvoker.cs (3)
85/// Invoke the server streaming method with the specified <see cref="HttpContext"/>. 87/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 92public async Task Invoke(HttpContext httpContext, ServerCallContext serverCallContext, TRequest request, IServerStreamWriter<TResponse> streamWriter)
src\Grpc\JsonTranscoding\src\Shared\Server\UnaryServerMethodInvoker.cs (3)
81/// Invoke the unary method with the specified <see cref="HttpContext"/>. 83/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 88public async Task<TResponse> Invoke(HttpContext httpContext, ServerCallContext serverCallContext, TRequest request)
Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests (2)
UnaryServerCallHandlerTests.cs (2)
1568HttpContext? httpContext = null; 1631Action<HttpContext>? configureHttpContext = null,
Microsoft.AspNetCore.HeaderParsing (2)
HeaderParsingFeature.cs (1)
27internal HttpContext? Context { get; set; }
HeaderParsingHttpRequestExtensions.cs (1)
23var context = Throw.IfNull(request).HttpContext;
Microsoft.AspNetCore.HeaderParsing.Tests (7)
HeaderParsingExtensionsTests.cs (5)
87var context = CreateContext(new ServiceCollection().AddSingleton(headerRegistry.Object)); 94var context = CreateContext(new ServiceCollection().AddHeaderParsing()); 108var context = CreateContext(new ServiceCollection().AddHeaderParsing()); 121private static HttpContext CreateContext(IServiceCollection? services = null) 132private static HeaderKey<T> RegisterHeader<T>(HttpContext context, HeaderSetup<T> setup)
HeaderParsingFeatureTests.cs (2)
27private HttpContext? _context; 31private HttpContext Context
Microsoft.AspNetCore.HeaderPropagation (7)
HeaderPropagationContext.cs (4)
18/// <param name="httpContext">The <see cref="Http.HttpContext"/> associated with the current request.</param> 21public HeaderPropagationContext(HttpContext httpContext, string headerName, StringValues headerValue) 32/// Gets the <see cref="Http.HttpContext"/> associated with the current request. 34public HttpContext HttpContext { get; }
HeaderPropagationMiddleware.cs (3)
42/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 43public Task Invoke(HttpContext context) 69private static StringValues GetValue(HttpContext context, HeaderPropagationEntry entry)
Microsoft.AspNetCore.HeaderPropagation.Tests (2)
HeaderPropagationIntegrationTest.cs (1)
248public Task InvokeAsync(HttpContext _)
HeaderPropagationMiddlewareTest.cs (1)
119HttpContext receivedContext = null;
Microsoft.AspNetCore.HostFiltering (4)
HostFilteringMiddleware.cs (4)
53public Task Invoke(HttpContext context) 66private static Task HostValidationFailed(HttpContext context, MiddlewareConfiguration middlewareConfiguration) 82private bool CheckHost(HttpContext context, MiddlewareConfiguration middlewareConfiguration) 115private bool IsEmptyHostAllowed(HttpContext context, MiddlewareConfiguration middlewareConfiguration)
Microsoft.AspNetCore.Hosting (46)
Http\DefaultHttpContextFactory.cs (7)
15/// A factory for creating <see cref="HttpContext" /> instances. 26/// Creates a factory for creating <see cref="HttpContext" /> instances. 40/// Create an <see cref="HttpContext"/> instance given an <paramref name="featureCollection" />. 43/// <returns>An initialized <see cref="HttpContext"/> object.</returns> 44public HttpContext Create(IFeatureCollection featureCollection) 71/// Clears the current <see cref="HttpContext" />. 73public void Dispose(HttpContext httpContext)
Internal\HostingApplication.cs (3)
61HttpContext httpContext; 95var httpContext = context.HttpContext!; 123public HttpContext? HttpContext { get; set; }
Internal\HostingApplicationDiagnostics.cs (29)
54public void BeginRequest(HttpContext httpContext, HostingApplication.Context context) 138public void RequestEnd(HttpContext httpContext, Exception? exception, HostingApplication.Context context) 305private void RecordBeginRequestDiagnostics(HttpContext httpContext, long startTimestamp) 314private void RecordEndRequestDiagnostics(HttpContext httpContext, long currentTimestamp) 323private void RecordUnhandledExceptionDiagnostics(HttpContext httpContext, long currentTimestamp, Exception exception) 334[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))] 335[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))] 339internal DeprecatedRequestData(HttpContext httpContext, long timestamp) 346public HttpContext httpContext { get; } 355[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))] 356[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))] 360internal UnhandledExceptionData(HttpContext httpContext, long timestamp, Exception exception) 368public HttpContext httpContext { get; } 376private void RecordRequestStartEventLog(HttpContext httpContext) 382private void RecordRequestStartMetrics(HttpContext httpContext) 388private Activity? StartActivity(HttpContext httpContext, bool loggingEnabled, bool diagnosticListenerActivityCreationEnabled, out bool hasDiagnosticListener) 429private void StopActivity(HttpContext httpContext, Activity activity, bool hasDiagnosticListener) 444[DynamicDependency(nameof(HttpContext.Request), typeof(HttpContext))] 457private Activity StartActivity(Activity activity, HttpContext httpContext) 466[DynamicDependency(nameof(HttpContext.Response), typeof(HttpContext))] 471private void StopActivity(Activity activity, HttpContext httpContext) 485public static IDisposable? RequestScope(ILogger logger, HttpContext httpContext) 516public HostingLogScope(HttpContext httpContext)
Internal\HostingRequestStartingLog.cs (1)
38public HostingRequestStartingLog(HttpContext httpContext)
Internal\HostingRequestUnhandledLog.cs (2)
15private readonly HttpContext _httpContext; 33public HostingRequestUnhandledLog(HttpContext httpContext)
src\Shared\HttpExtensions.cs (2)
36internal static Endpoint? GetOriginalEndpoint(HttpContext context) 49internal static void ClearEndpoint(HttpContext context)
src\Shared\RazorViews\BaseView.cs (2)
28protected HttpContext Context { get; private set; } = default!; 80public async Task ExecuteAsync(HttpContext context)
Microsoft.AspNetCore.Hosting.Tests (13)
HostingApplicationDiagnosticsTests.cs (7)
542Assert.IsAssignableFrom<HttpContext>(o); 576Assert.IsAssignableFrom<HttpContext>(o); 612AssertProperty<HttpContext>(pair.Value, "HttpContext"); 637AssertProperty<HttpContext>(pair.Value, "HttpContext"); 661AssertProperty<HttpContext>(pair.Value, "HttpContext"); 997Assert.IsAssignableFrom<HttpContext>(context); 1096httpContextFactory.Setup(s => s.Dispose(It.IsAny<HttpContext>()));
HostingApplicationTests.cs (1)
76factory.Setup(m => m.Dispose(It.IsAny<HttpContext>())).Callback(() => { });
Http\DefaultHttpContextFactoryTests.cs (3)
23var context = contextFactory.Create(new FeatureCollection()); 41var context = contextFactory.Create(new FeatureCollection()); 61var context = contextFactory.Create(new FeatureCollection());
Internal\HostingRequestStartLogTests.cs (1)
27var mockContext = new Mock<HttpContext>();
WebHostTests.cs (1)
941HttpContext capturedContext = null;
Microsoft.AspNetCore.Http (18)
DefaultHttpContext.cs (1)
224public HttpContext HttpContext => this;
Features\DefaultSessionFeature.cs (1)
8/// <see cref="HttpContext.Session"/> property without the need for creating a <see cref="ISessionFeature"/>.
Features\FormFeature.cs (1)
208using (cancellationToken.Register((state) => ((HttpContext)state!).Abort(), _request.HttpContext))
Features\RequestBodyPipeFeature.cs (2)
15private readonly HttpContext _context; 24public RequestBodyPipeFeature(HttpContext context)
Features\RequestServicesFeature.cs (3)
17private readonly HttpContext _context; 22/// <param name="context">The <see cref="HttpContext"/>.</param> 24public RequestServicesFeature(HttpContext context, IServiceScopeFactory? scopeFactory)
Features\RouteValuesFeature.cs (1)
9/// A feature for routing values. Use <see cref="HttpContext.Features"/>
HttpContextAccessor.cs (2)
17public HttpContext? HttpContext 43public HttpContext? Context;
Internal\DefaultHttpRequest.cs (2)
21private static readonly Func<HttpContext, IRequestBodyPipeFeature> _newRequestBodyPipeFeature = context => new RequestBodyPipeFeature(context); 47public override HttpContext HttpContext => _context;
Internal\DefaultHttpResponse.cs (1)
54public override HttpContext HttpContext { get { return _context; } }
src\Shared\Debugger\HttpContextDebugFormatter.cs (1)
53public static string ContextToString(HttpContext context, string? reasonPhrase)
Timeouts\CancellationTokenLinker.cs (1)
12public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan)
Timeouts\ICancellationTokenLinker.cs (1)
8(CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan);
Timeouts\RequestTimeoutsMiddleware.cs (1)
29public Task Invoke(HttpContext context)
Microsoft.AspNetCore.Http.Abstractions (91)
CookieBuilder.cs (6)
63/// This is determined from the <see cref="HttpContext"/> passed to <see cref="Build(HttpContext, DateTimeOffset)"/>. 95/// <param name="context">The <see cref="HttpContext"/>.</param> 97public CookieOptions Build(HttpContext context) => Build(context, DateTimeOffset.Now); 102/// <param name="context">The <see cref="HttpContext"/>.</param> 105public virtual CookieOptions Build(HttpContext context, DateTimeOffset expiresFrom)
DefaultEndpointFilterInvocationContext.cs (2)
17public DefaultEndpointFilterInvocationContext(HttpContext httpContext, params object?[] arguments) 24public override HttpContext HttpContext { get; }
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\MapMiddleware.cs (3)
38/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 40public Task Invoke(HttpContext context) 55private async Task InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
Extensions\MapWhenExtensions.cs (1)
9using Predicate = Func<HttpContext, bool>;
Extensions\MapWhenMiddleware.cs (2)
43/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 45public Task Invoke(HttpContext context)
Extensions\MapWhenOptions.cs (2)
13private Func<HttpContext, bool>? _predicate; 18public Func<HttpContext, bool>? Predicate
Extensions\UseExtensions.cs (3)
17/// Prefer using <see cref="Use(IApplicationBuilder, Func{HttpContext, RequestDelegate, Task})"/> for better performance as shown below: 29public static IApplicationBuilder Use(this IApplicationBuilder app, Func<HttpContext, Func<Task>, Task> middleware) 48public static IApplicationBuilder Use(this IApplicationBuilder app, Func<HttpContext, RequestDelegate, Task> middleware)
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);
Extensions\UsePathBaseMiddleware.cs (3)
37/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 39public Task Invoke(HttpContext context) 50private async Task InvokeCore(HttpContext context, PathString matchedPath, PathString remainingPath)
Extensions\UseWhenExtensions.cs (1)
8using Predicate = Func<HttpContext, bool>;
HttpContext.cs (2)
85private sealed class HttpContextDebugView(HttpContext context) 87private readonly HttpContext _context = context;
HttpRequest.cs (1)
22public abstract HttpContext HttpContext { get; }
HttpResponse.cs (1)
37public abstract HttpContext HttpContext { get; }
HttpResults\EmptyHttpResult.cs (1)
22public Task ExecuteAsync(HttpContext httpContext)
HttpResults\IResult.cs (2)
14/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 16Task ExecuteAsync(HttpContext httpContext);
IBindableFromHttpContextOfT.cs (4)
9/// Defines a mechanism for creating an instance of a type from an <see cref="HttpContext"/> when binding parameters for an endpoint 16/// Creates an instance of <typeparamref name="TSelf"/> from the <see cref="HttpContext"/>. 18/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 21static abstract ValueTask<TSelf?> BindAsync(HttpContext context, ParameterInfo parameter);
IHttpContextAccessor.cs (1)
18HttpContext? HttpContext { get; set; }
IHttpContextFactory.cs (7)
9/// Provides methods to create and dispose of <see cref="HttpContext"/> instances. 14/// Creates an <see cref="HttpContext"/> instance for the specified set of HTTP features. 17/// <returns>The <see cref="HttpContext"/> instance.</returns> 18HttpContext Create(IFeatureCollection featureCollection); 21/// Releases resources held by the <see cref="HttpContext"/>. 23/// <param name="httpContext">The <see cref="HttpContext"/> to dispose.</param> 24void Dispose(HttpContext httpContext);
IMiddleware.cs (2)
14/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 17Task InvokeAsync(HttpContext context, RequestDelegate next);
ProblemDetails\IProblemDetailsWriter.cs (1)
8/// payload to the current <see cref="HttpContext.Response"/>.
ProblemDetails\ProblemDetailsContext.cs (1)
18public required HttpContext HttpContext { get; init; }
RequestDelegate.cs (2)
9/// <param name="context">The <see cref="HttpContext"/> for the request.</param> 11public delegate Task RequestDelegate(HttpContext context);
Routing\EndpointHttpContextExtensions.cs (4)
16/// <param name="context">The <see cref="HttpContext"/> context.</param> 22public static Endpoint? GetEndpoint(this HttpContext context) 32/// <param name="context">The <see cref="HttpContext"/> context.</param> 34public static void SetEndpoint(this HttpContext context, Endpoint? endpoint)
Routing\IEndpointFeature.cs (1)
7/// A feature interface for endpoint routing. Use <see cref="HttpContext.Features"/>
Routing\IRouteValuesFeature.cs (1)
9/// A feature interface for routing values. Use <see cref="HttpContext.Features"/>
src\Shared\Debugger\HttpContextDebugFormatter.cs (1)
53public static string ContextToString(HttpContext context, string? reasonPhrase)
Microsoft.AspNetCore.Http.Abstractions.Tests (52)
HttpResponseWritingExtensionsTests.cs (6)
13HttpContext context = CreateRequest(); 22HttpContext context = CreateRequest(); 35HttpContext context = new DefaultHttpContext(); 54HttpContext context = CreateRequest(); 84private HttpContext CreateRequest() 86HttpContext context = new DefaultHttpContext();
MapPathMiddlewareTests.cs (10)
12private static Task Success(HttpContext context) 25private static Task NotImplemented(HttpContext context) 56HttpContext context = CreateRequest(basePath, requestPath); 86HttpContext context = CreateRequest(basePath, requestPath); 114HttpContext context = CreateRequest(basePath, requestPath); 144HttpContext context = CreateRequest(basePath, requestPath); 166HttpContext context = CreateRequest(basePath, requestPath); 190HttpContext context = CreateRequest(string.Empty, "/route1"); 238private HttpContext CreateRequest(string basePath, string requestPath) 240HttpContext context = new DefaultHttpContext();
MapPredicateMiddlewareTests.cs (11)
8using Predicate = Func<HttpContext, bool>; 14private static Task Success(HttpContext context) 25private static Task NotImplemented(HttpContext context) 35private bool TruePredicate(HttpContext context) 40private bool FalsePredicate(HttpContext context) 62HttpContext context = CreateRequest(); 74HttpContext context = CreateRequest(); 86HttpContext context = CreateRequest(); 108HttpContext context = CreateRequest(); 113private HttpContext CreateRequest() 115HttpContext context = new DefaultHttpContext();
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;
UsePathBaseExtensionsTests.cs (3)
210HttpContext requestContext = CreateRequest(pathBase, requestPath); 230private static HttpContext CreateRequest(string pathBase, string requestPath) 232HttpContext context = new DefaultHttpContext();
UseWhenExtensionsTests.cs (8)
29var context = CreateContext(); 57var context = CreateContext(); 85var context = CreateContext(); 103private static HttpContext CreateContext() 113private static bool TruePredicate(HttpContext context) 118private static bool FalsePredicate(HttpContext context) 123private static Func<HttpContext, Func<Task>, Task> Increment(string key, bool terminate = false) 149private static int Count(HttpContext context, string key)
Microsoft.AspNetCore.Http.Connections (32)
Features\IHttpContextFeature.cs (3)
9/// Feature set on the <see cref="ConnectionContext"/> that provides access to the underlying <see cref="Http.HttpContext"/> 15/// The <see cref="Http.HttpContext"/> associated with the connection if available. 21HttpContext? HttpContext { get; set; }
HttpConnectionContextExtensions.cs (4)
10/// Extension method to get the underlying <see cref="HttpContext"/> of the connection if there is one. 15/// Gets the <see cref="HttpContext"/> associated with the connection, if there is one. 18/// <returns>The <see cref="HttpContext"/> associated with the connection, or <see langword="null"/> if the connection is not HTTP-based.</returns> 23public static HttpContext? GetHttpContext(this ConnectionContext connection)
Internal\HttpConnectionContext.cs (5)
207public HttpContext? HttpContext { get; set; } 409HttpContext context, 441HttpContext nonClonedContext, 510private void FailActivationUnsynchronized(HttpContext nonClonedContext, ILogger dispatcherLogger) 532internal async Task<bool> CancelPreviousPoll(HttpContext context)
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)
Internal\Transports\IHttpTransport.cs (1)
14Task<bool> ProcessRequestAsync(HttpContext context, CancellationToken token);
Internal\Transports\LongPollingServerTransport.cs (1)
32public async Task<bool> ProcessRequestAsync(HttpContext context, CancellationToken token)
Internal\Transports\ServerSentEventsServerTransport.cs (1)
31public async Task<bool> ProcessRequestAsync(HttpContext context, CancellationToken cancellationToken)
Internal\Transports\WebSocketsServerTransport.cs (1)
37public async Task<bool> ProcessRequestAsync(HttpContext context, CancellationToken token)
Microsoft.AspNetCore.Http.Connections.Tests (6)
HttpConnectionDispatcherTests.cs (6)
813var connectionHttpContext = connection.GetHttpContext(); 3240string GenerateToken(HttpContext httpContext) 3402string GenerateToken(HttpContext httpContext) 3750private static void SetTransport(HttpContext context, HttpTransportType transportType, SyncPoint sync = null) 3855var context = connection.GetHttpContext(); 3916var context = connection.GetHttpContext();
Microsoft.AspNetCore.Http.Extensions (82)
DefaultProblemDetailsWriter.cs (2)
28var httpContext = context.HttpContext; 55var httpContext = context.HttpContext;
HttpContextServerVariableExtensions.cs (1)
22public static string? GetServerVariable(this HttpContext context, string variableName)
HttpRequestJsonExtensions.cs (2)
303private static JsonSerializerOptions ResolveSerializerOptions(HttpContext httpContext) 315private static (Stream inputStream, bool usesTranscodingStream) GetInputStream(HttpContext httpContext, Encoding? encoding)
HttpResponseJsonExtensions.cs (1)
342private static JsonSerializerOptions ResolveSerializerOptions(HttpContext httpContext)
RequestDelegateFactory.cs (70)
76private static readonly MethodInfo LogParameterBindingFailedMethod = GetMethodInfo<Action<HttpContext, string, string, string, bool>>((httpContext, parameterType, parameterName, sourceValue, shouldThrow) => 78private static readonly MethodInfo LogRequiredParameterNotProvidedMethod = GetMethodInfo<Action<HttpContext, string, string, string, bool>>((httpContext, parameterType, parameterName, source, shouldThrow) => 80private static readonly MethodInfo LogImplicitBodyNotProvidedMethod = GetMethodInfo<Action<HttpContext, string, bool>>((httpContext, parameterName, shouldThrow) => 82private static readonly MethodInfo LogFormMappingFailedMethod = GetMethodInfo<Action<HttpContext, string, string, FormDataMappingException, bool>>((httpContext, parameterName, parameterType, exception, shouldThrow) => 91private static readonly MemberExpression RequestServicesExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.RequestServices))!); 92private static readonly MemberExpression HttpRequestExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Request))!); 93private static readonly MemberExpression HttpResponseExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!); 94private static readonly MemberExpression RequestAbortedExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.RequestAborted))!); 95private static readonly MemberExpression UserExpr = Expression.Property(HttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.User))!); 111private static readonly ConstructorInfo DefaultEndpointFilterInvocationContextConstructor = typeof(DefaultEndpointFilterInvocationContext).GetConstructor(new[] { typeof(HttpContext), typeof(object[]) })!; 117private static readonly MemberExpression FilterContextHttpContextResponseExpr = Expression.Property(FilterContextHttpContextExpr, typeof(HttpContext).GetProperty(nameof(HttpContext.Response))!); 187Expression<Func<HttpContext, object?>> targetFactory = (httpContext) => handler.Target; 208public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory, RequestDelegateFactoryOptions? options) 227public static RequestDelegateResult Create(MethodInfo methodInfo, Func<HttpContext, object>? targetFactory = null, RequestDelegateFactoryOptions? options = null, RequestDelegateMetadataResult? metadataResult = null) 312private static Func<object?, HttpContext, Task>? CreateTargetableRequestDelegate( 316Expression<Func<HttpContext, object?>>? targetFactory = null) 412private static EndpointFilterDelegate? CreateFilterPipeline(MethodInfo methodInfo, Expression? targetExpression, RequestDelegateFactoryContext factoryContext, Expression<Func<HttpContext, object?>>? targetFactory) 826else if (parameter.ParameterType == typeof(HttpContext)) 1251private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegate(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext) 1258var continuation = Expression.Lambda<Func<object?, HttpContext, object?[], Task>>( 1278return Expression.Lambda<Func<object?, HttpContext, Task>>( 1292private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForJson(Expression responseWritingMethodCall, RequestDelegateFactoryContext factoryContext) 1306var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>( 1343var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>( 1367HttpContext httpContext, 1425private static Func<object?, HttpContext, Task> HandleRequestBodyAndCompileRequestDelegateForForm( 1441var continuation = Expression.Lambda<Func<object?, HttpContext, object?, object?[], Task>>( 1475var continuation = Expression.Lambda<Func<object?, HttpContext, object?, Task>>( 1496HttpContext httpContext, 1985var bindAsyncDelegate = Expression.Lambda<Func<HttpContext, ValueTask<object?>>>(bindAsyncMethod.Expression, HttpContextExpr).Compile(); 2389private static Task ExecuteValueTaskOfObject(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 2391static async Task ExecuteAwaited(ValueTask<object> valueTask, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 2404private static Task ExecuteTaskOfObject(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 2406static async Task ExecuteAwaited(Task<object> task, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 2419private static Task ExecuteAwaitedReturn(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 2424private static Task ExecuteTaskOfTFast<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2428static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2441private static Task ExecuteTaskOfT<T>(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2445static async Task ExecuteAwaited(Task<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2458private static Task ExecuteTaskOfString(Task<string?> task, HttpContext httpContext) 2463static async Task ExecuteAwaited(Task<string> task, HttpContext httpContext) 2476private static Task ExecuteWriteStringResponseAsync(HttpContext httpContext, string text) 2531private static Task ExecuteValueTaskOfTFast<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2533static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2546private static Task ExecuteValueTaskOfT<T>(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2548static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext, JsonTypeInfo<T> jsonTypeInfo) 2561private static Task ExecuteValueTaskOfString(ValueTask<string?> task, HttpContext httpContext) 2565static async Task ExecuteAwaited(ValueTask<string> task, HttpContext httpContext) 2578private static Task ExecuteValueTaskResult<T>(ValueTask<T?> task, HttpContext httpContext) where T : IResult 2580static async Task ExecuteAwaited(ValueTask<T> task, HttpContext httpContext) 2593private static async Task ExecuteTaskResult<T>(Task<T?> task, HttpContext httpContext) where T : IResult 2600private static async Task ExecuteResultWriteResponse(IResult? result, HttpContext httpContext) 2644public static void RequestBodyIOException(HttpContext httpContext, IOException exception) 2650public static void InvalidJsonRequestBody(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow) 2664public static void ParameterBindingFailed(HttpContext httpContext, string parameterTypeName, string parameterName, string sourceValue, bool shouldThrow) 2678public static void RequiredParameterNotProvided(HttpContext httpContext, string parameterTypeName, string parameterName, string source, bool shouldThrow) 2692public static void ImplicitBodyNotProvided(HttpContext httpContext, string parameterName, bool shouldThrow) 2706public static void UnexpectedJsonContentType(HttpContext httpContext, string? contentType, bool shouldThrow) 2720public static void UnexpectedNonFormContentType(HttpContext httpContext, string? contentType, bool shouldThrow) 2734public static void InvalidFormRequestBody(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow) 2748public static void InvalidAntiforgeryToken(HttpContext httpContext, string parameterTypeName, string parameterName, Exception exception, bool shouldThrow) 2762public static void FormDataMappingFailed(HttpContext httpContext, string parameterTypeName, string parameterName, FormDataMappingException exception, bool shouldThrow) 2776public static void UnexpectedRequestWithoutBody(HttpContext httpContext, string parameterTypeName, string parameterName, bool shouldThrow) 2790private static ILogger GetLogger(HttpContext httpContext)
src\Shared\ParameterBindingMethodCache.cs (4)
39internal static readonly ParameterExpression HttpContextExpr = Expression.Parameter(typeof(HttpContext), "httpContext"); 226methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext), typeof(ParameterInfo) }, ValidateReturnType); 231methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext) }, ValidateReturnType); 424private static ValueTask<TValue?> BindAsync<TValue>(HttpContext httpContext, ParameterInfo parameter)
src\Shared\RouteHandlers\ExecuteHandlerHelper.cs (2)
12public static Task ExecuteReturnAsync(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 31public static void SetPlaintextContentType(HttpContext httpContext)
Microsoft.AspNetCore.Http.Extensions.Tests (553)
HttpResponseJsonExtensionsTests.cs (2)
496app.MapGet("/", IAsyncEnumerable<int> (HttpContext httpContext) => 529app.MapGet("/", IEnumerable<int> (HttpContext httpContext) =>
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)
ProblemDetailsDefaultWriterTest.cs (19)
27var context = CreateContext(stream); 65var context = CreateContext(stream); 97var context = CreateContext(stream); 129var context = CreateContext(stream); 173var context = CreateContext(stream); 213var context = CreateContext(stream); 250var context = CreateContext(stream); 293var context = CreateContext(stream); 336var context = CreateContext(stream); 379var context = CreateContext(stream); 422var context = CreateContext(stream); 462var context = CreateContext(stream); 508var context = CreateContext(stream); 551var context = CreateContext(stream, StatusCodes.Status500InternalServerError); 584var context = CreateContext(stream, StatusCodes.Status500InternalServerError); 616var context = CreateContext(stream, StatusCodes.Status500InternalServerError); 647var context = CreateContext(stream, contentType: contentType); 664var context = CreateContext(stream, contentType: contentType); 673private static HttpContext CreateContext(
RequestDelegateFactoryTests.cs (170)
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, 695(HttpContext httpContext, MyAwaitedBindAsyncRecord myAwaitedBindAsyncRecord, MyAwaitedBindAsyncStruct myAwaitedBindAsyncStruct) => 747void StoreNullableIntArray(HttpContext httpContext, int?[] values) 777private record ParametersListWithImplictFromBody(HttpContext HttpContext, TodoStruct Todo); 779private record ParametersListWithExplictFromBody(HttpContext HttpContext, [FromBody] Todo Todo); 785void TestImpliedFromBody(HttpContext httpContext, Todo todo) 790void TestImpliedFromBodyInterface(HttpContext httpContext, ITodo todo) 795void TestImpliedFromBodyStruct(HttpContext httpContext, TodoStruct todo) 807new[] { (Action<HttpContext, Todo>)TestImpliedFromBody }, 808new[] { (Action<HttpContext, ITodo>)TestImpliedFromBodyInterface }, 809new object[] { (Action<HttpContext, TodoStruct>)TestImpliedFromBodyStruct }, 972public static Task<BadBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter) => 978public static Task<BadBindAsyncClass> BindAsync(HttpContext context, ParameterInfo parameter) => 1035private record ParametersListWithImplictFromService(HttpContext HttpContext, IMyService MyService); 1037private record ParametersListWithExplictFromService(HttpContext HttpContext, [FromService] MyService MyService); 1043void TestExplicitFromService(HttpContext httpContext, [FromService] MyService myService) 1053void TestExplicitFromIEnumerableService(HttpContext httpContext, [FromService] IEnumerable<MyService> myServices) 1058void TestExplicitMultipleFromService(HttpContext httpContext, [FromService] MyService myService, [FromService] IEnumerable<MyService> myServices) 1065new[] { (Action<HttpContext, MyService>)TestExplicitFromService }, 1067new[] { (Action<HttpContext, IEnumerable<MyService>>)TestExplicitFromIEnumerableService }, 1068new[] { (Action<HttpContext, MyService, IEnumerable<MyService>>)TestExplicitMultipleFromService }, 1077void TestImpliedFromService(HttpContext httpContext, IMyService myService) 1087void TestImpliedIEnumerableFromService(HttpContext httpContext, IEnumerable<MyService> myServices) 1092void TestImpliedFromServiceBasedOnContainer(HttpContext httpContext, MyService myService) 1099new[] { (Action<HttpContext, IMyService>)TestImpliedFromService }, 1101new[] { (Action<HttpContext, IEnumerable<MyService>>)TestImpliedIEnumerableFromService }, 1102new[] { (Action<HttpContext, MyService>)TestImpliedFromServiceBasedOnContainer }, 1195HttpContext? httpContextArgument = null; 1197void TestAction(HttpContext httpContext) 1600void requiredReferenceType(HttpContext context, MyBindAsyncRecord myBindAsyncRecord) 1604void defaultReferenceType(HttpContext context, MyBindAsyncRecord? myBindAsyncRecord = null) 1608void nullableReferenceType(HttpContext context, MyBindAsyncRecord? myBindAsyncRecord) 1612void requiredReferenceTypeSimple(HttpContext context, MySimpleBindAsyncRecord mySimpleBindAsyncRecord) 1617void requiredValueType(HttpContext context, MyNullableBindAsyncStruct myNullableBindAsyncStruct) 1621void defaultValueType(HttpContext context, MyNullableBindAsyncStruct? myNullableBindAsyncStruct = null) 1625void nullableValueType(HttpContext context, MyNullableBindAsyncStruct? myNullableBindAsyncStruct) 1629void requiredValueTypeSimple(HttpContext context, MySimpleBindAsyncStruct mySimpleBindAsyncStruct) 1636new object?[] { (Action<HttpContext, MyBindAsyncRecord>)requiredReferenceType, false, true, false }, 1637new object?[] { (Action<HttpContext, MyBindAsyncRecord>)requiredReferenceType, true, false, false, }, 1638new object?[] { (Action<HttpContext, MySimpleBindAsyncRecord>)requiredReferenceTypeSimple, true, false, false }, 1640new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)defaultReferenceType, false, false, false, }, 1641new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)defaultReferenceType, true, false, false }, 1643new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)nullableReferenceType, false, false, false }, 1644new object?[] { (Action<HttpContext, MyBindAsyncRecord?>)nullableReferenceType, true, false, false }, 1646new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct>)requiredValueType, false, true, true }, 1647new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct>)requiredValueType, true, false, true }, 1648new object?[] { (Action<HttpContext, MySimpleBindAsyncStruct>)requiredValueTypeSimple, true, false, true }, 1650new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)defaultValueType, false, false, true }, 1651new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)defaultValueType, true, false, true }, 1653new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)nullableValueType, false, false, true }, 1654new object?[] { (Action<HttpContext, MyNullableBindAsyncStruct?>)nullableValueType, true, false, true }, 2042public static ValueTask<TraceIdentifier> BindAsync(HttpContext context) 2120void TestAction(HttpContext context, [AsParameters] SampleParameterList args, [AsParameters] SampleParameterList args2) 2203Func<HttpContext, object> targetFactory = (context) => 2399async Task HandlerWithTaskAwait(HttpContext c) 3090var @delegate = (string name, HttpContext context) => context.Items.Add("param", name); 3117public HttpContext? HttpContext { get; set; } 3162public HttpContext HttpContext { get; set; } 3301public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 3306public static ValueTask<AccessesServicesMetadataBinder> BindAsync(HttpContext context, ParameterInfo parameter) => 3333public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException(); 3343public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException(); 3354public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 3419public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException(); 3470public static ValueTask<AddsCustomParameterMetadataBindable> BindAsync(HttpContext context, ParameterInfo parameter) => default; 3542public static async ValueTask<JsonTodo?> BindAsync(HttpContext context, ParameterInfo parameter) 3586public void Handle(HttpContext httpContext) 3610public Task ExecuteAsync(HttpContext httpContext) 3625public Task ExecuteAsync(HttpContext httpContext)
RequestDelegateFactoryTests.EndpointFilters.cs (40)
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\CompileTimeCreationTests.cs (17)
32var httpContext = CreateHttpContext(); 44var httpContext = CreateHttpContext(); 146var httpContext = CreateHttpContext(); 182var httpContext = CreateHttpContext(); 359var httpContext = CreateHttpContext(); 383var httpContext = CreateHttpContext(); 409var httpContext = CreateHttpContext(); 457var httpContext = CreateHttpContext(); 474var httpContext = CreateHttpContext(); 501var httpContext1 = CreateHttpContext(); 508var httpContext2 = CreateHttpContext(); 520void PopulateHttpContext(HttpContext httpContext, string sourceAttribute, string value) 549var httpContext1 = CreateHttpContext(); 554var httpContext2 = CreateHttpContext(); 593var httpContext = CreateHttpContext(); 612var httpContext = CreateHttpContext(); 779var httpContext = CreateHttpContext();
RequestDelegateGenerator\CompileTimeCreationTests.Routes.cs (3)
25var httpContext = CreateHttpContext(); 48var httpContext = CreateHttpContext(); 77var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (7)
197internal HttpContext CreateHttpContext(IServiceProvider serviceProvider = null) 219internal HttpContext CreateHttpContextWithBody(Todo requestData, IServiceProvider serviceProvider = null) 221var httpContext = CreateHttpContext(serviceProvider); 232internal static async Task<string> GetResponseBodyAsync(HttpContext httpContext) 240internal static async Task VerifyResponseJsonBodyAsync<T>(HttpContext httpContext, Action<T> check, int expectedStatusCode = 200) 252internal static async Task VerifyResponseJsonNodeAsync(HttpContext httpContext, Action<JsonNode> check, int expectedStatusCode = 200, string expectedContentType = "application/json; charset=utf-8") 262internal static async Task VerifyResponseBodyAsync(HttpContext httpContext, string expectedBody, int expectedStatusCode = 200)
RequestDelegateGenerator\RequestDelegateCreationTests.Arrays.cs (31)
35var httpContext = CreateHttpContext(); 56var httpContext = CreateHttpContext(); 77var httpContext = CreateHttpContext(); 98var httpContext = CreateHttpContext(); 171var httpContext = CreateHttpContext(); 196var httpContext = CreateHttpContext(); 217var httpContext = CreateHttpContext(); 238var httpContext = CreateHttpContext(); 259var httpContext = CreateHttpContext(); 279var httpContext = CreateHttpContext(); 300var httpContext = CreateHttpContext(); 321var httpContext = CreateHttpContext(); 343var httpContext = CreateHttpContext(); 365var httpContext = CreateHttpContext(); 386var httpContext = CreateHttpContext(); 408var httpContext = CreateHttpContext(); 429var httpContext = CreateHttpContext(); 451var httpContext = CreateHttpContext(); 472var httpContext = CreateHttpContext(); 494var httpContext = CreateHttpContext(); 515var httpContext = CreateHttpContext(); 537var httpContext = CreateHttpContext(); 558var httpContext = CreateHttpContext(); 580var httpContext = CreateHttpContext(); 600var httpContext = CreateHttpContext(); 621var httpContext = CreateHttpContext(); 648var httpContext = CreateHttpContext(); 675var httpContext = CreateHttpContext(); 702var httpContext = CreateHttpContext(); 729var httpContext = CreateHttpContext(); 758var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.AsParameters.cs (9)
27var httpContext = CreateHttpContext(); 67var httpContext = CreateHttpContext(); 95var httpContext = CreateHttpContext(); 199var httpContext = CreateHttpContext(); 218var httpContext = CreateHttpContext(); 278var httpContext = CreateHttpContext(); 312var httpContext = CreateHttpContext(); 339var httpContext = CreateHttpContext(); 380var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.BindAsync.cs (9)
56var httpContext = CreateHttpContext(); 77var httpContext = CreateHttpContext(); 98var httpContext = CreateHttpContext(); 128var httpContext = CreateHttpContext(); 176var httpContext = CreateHttpContext(); 194var httpContext = CreateHttpContext(); 209var httpContext = CreateHttpContext(); 265var httpContext = CreateHttpContext(); 326var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.cs (17)
42var httpContext = CreateHttpContext(); 72var httpContext = CreateHttpContext(); 95var httpContext = CreateHttpContext(); 158var httpContext = CreateHttpContext(); 210var httpContext = CreateHttpContext(); 267var httpContext = CreateHttpContext(); 297var httpContext = CreateHttpContext(); 393var httpContext = CreateHttpContext(); 411var httpContext = CreateHttpContext(); 430var httpContext = CreateHttpContext(); 456var httpContext = CreateHttpContext(); 482var httpContext = CreateHttpContext(); 503var httpContext = CreateHttpContext(); 528var httpContext = CreateHttpContext(); 553var httpContext = CreateHttpContext(); 582var httpContext = CreateHttpContext(); 624var httpContext = CreateHttpContext(serviceProvider);
RequestDelegateGenerator\RequestDelegateCreationTests.Filters.cs (14)
32var httpContext = CreateHttpContext(); 61var httpContext = CreateHttpContext(); 97var httpContext = CreateHttpContext(); 139var httpContext = CreateHttpContext(); 181var httpContext = CreateHttpContext(); 223var httpContext = CreateHttpContext(); 267var httpContext = CreateHttpContextWithBody(new Todo { Name = "Write tests", IsComplete = true }); 297var httpContext = CreateHttpContext(); 338var httpContext = CreateHttpContext(); 401var httpContext = CreateHttpContext(); 458var httpContext = CreateHttpContext(); 524var httpContext = CreateHttpContext(); 548var httpContext = CreateHttpContext(); 615var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.Forms.cs (27)
34var httpContext = CreateHttpContext(); 69var httpContext = CreateHttpContext(); 104var httpContext = CreateHttpContext(); 142var httpContext = CreateHttpContext(); 180var httpContext = CreateHttpContext(); 221var httpContext = CreateHttpContext(); 258var httpContext = CreateHttpContext(); 294var httpContext = CreateHttpContext(); 321var httpContext = CreateHttpContext(); 326var factoryResult = RequestDelegateFactory.Create((HttpContext context, IFormFile file) => 367var httpContext = CreateHttpContext(); 401var httpContext = CreateHttpContext(); 450var httpContext = CreateHttpContext(); 490var httpContext = CreateHttpContext(); 549var httpContext = CreateHttpContext(); 596var httpContext = CreateHttpContext(); 643var httpContext = CreateHttpContext(); 672var httpContext = CreateHttpContext(); 705var httpContext = CreateHttpContext(); 735var httpContext = CreateHttpContext(); 765var httpContext = CreateHttpContext(); 828var httpContext = CreateHttpContext(); 871var httpContext = CreateHttpContext(); 895var httpContext = CreateHttpContext(); 929var httpContext = CreateHttpContext(); 961var httpContext = CreateHttpContext(); 998var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBody.cs (10)
84var httpContext = CreateHttpContext(); 104var httpContext = CreateHttpContext(); 136var httpContext = CreateHttpContextWithBody(todo); 226var httpContext = CreateHttpContext(); 266var httpContext = CreateHttpContext(); 307var httpContext = CreateHttpContext(); 348var httpContext = CreateHttpContext(); 397var httpContext = CreateHttpContext(); 425var httpContext = CreateHttpContext(); 465var httpContext = CreateHttpContextWithBody(null);
RequestDelegateGenerator\RequestDelegateCreationTests.JsonBodyOrService.cs (5)
53var httpContext = CreateHttpContext(serviceProvider); 81var httpContext = CreateHttpContextWithBody(requestData, serviceProvider); 123var httpContext = hasBody ? CreateHttpContextWithBody(todo) : CreateHttpContextWithBody(null); 197var httpContext = CreateHttpContext(serviceProvider); 221var httpContext = CreateHttpContext(serviceProvider);
RequestDelegateGenerator\RequestDelegateCreationTests.KeyServices.cs (11)
25var httpContext = CreateHttpContext(serviceProvider); 71var httpContext1 = CreateHttpContext(serviceProvider); 73var httpContext2 = CreateHttpContext(serviceProvider); 91var httpContext = CreateHttpContext(serviceProvider); 111var httpContext = CreateHttpContext(serviceProvider); 126var httpContext = CreateHttpContext(); 142var httpContext = CreateHttpContext(); 168var httpContext = CreateHttpContext(serviceProvider); 197var httpContext = CreateHttpContext(serviceProvider); 224var httpContext = CreateHttpContext(serviceProvider); 250var httpContext = CreateHttpContext(serviceProvider);
RequestDelegateGenerator\RequestDelegateCreationTests.Logging.cs (15)
35var httpContext = CreateHttpContext(serviceProvider); 97var httpContext = CreateHttpContext(); 148var httpContext = CreateHttpContext(); 185var httpContext = CreateHttpContext(); 220var httpContext = CreateHttpContext(); 267var httpContext = CreateHttpContext(); 300var httpContext = CreateHttpContext(); 347var httpContext = CreateHttpContext(); 383var httpContext = CreateHttpContext(); 434var httpContext = CreateHttpContextWithBody(originalTodo); 480var httpContext = CreateHttpContext(); 516var httpContext = CreateHttpContext(); 557var httpContext = CreateHttpContext(); 596var httpContext = CreateHttpContext(); 636var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.QueryParameters.cs (5)
48var httpContext = CreateHttpContext(); 99var httpContext = CreateHttpContext(); 120var httpContext = CreateHttpContext(); 136var httpContext = CreateHttpContext(); 177var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.Responses.cs (23)
36var httpContext = CreateHttpContext(); 61var httpContext = CreateHttpContext(); 83var httpContext = CreateHttpContext(); 117var httpContext = CreateHttpContext(); 141var httpContext = CreateHttpContext(); 169var httpContext = CreateHttpContext(); 194var httpContext = CreateHttpContext(); 222var httpContext = CreateHttpContext(); 251var httpContext = CreateHttpContext(); 311var httpContext = CreateHttpContext(serviceProvider); 356var httpContext = CreateHttpContext(serviceProvider); 387var httpContext = CreateHttpContext(serviceProvider); 406var httpContext = CreateHttpContext(); 463var httpContext = CreateHttpContext(); 484var httpContext = CreateHttpContext(); 565var httpContext = CreateHttpContext(); 645var httpContext = CreateHttpContext(); 668var httpContext = CreateHttpContext(); 756var httpContext = CreateHttpContext(); 775var httpContext = CreateHttpContext(); 833var httpContext = CreateHttpContext(); 889var httpContext = CreateHttpContext(); 973var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.RouteParameter.cs (7)
50var httpContext = CreateHttpContext(); 110var httpContext = CreateHttpContext(); 134var httpContext = CreateHttpContext(); 151var httpContext = CreateHttpContext(); 185var httpContext = CreateHttpContext(); 201var httpContext = CreateHttpContext(); 225var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.SpecialTypes.cs (8)
36var httpContext = CreateHttpContext(); 56var httpContext = CreateHttpContext(); 79var httpContext = CreateHttpContext(); 99var httpContext = CreateHttpContext(); 118var httpContext = CreateHttpContext(); 142var httpContext = CreateHttpContext(); 246var httpContext = CreateHttpContext(); 278var httpContext = CreateHttpContext();
RequestDelegateGenerator\RequestDelegateCreationTests.TryParse.cs (9)
74var httpContext = CreateHttpContext(); 114var httpContext = CreateHttpContext(); 146var httpContext = CreateHttpContext(); 172var httpContext = CreateHttpContext(); 195var httpContext = CreateHttpContext(); 211var httpContext = CreateHttpContext(); 236var httpContext = CreateHttpContext(); 256var httpContext = CreateHttpContext(); 276var httpContext = CreateHttpContext();
RequestDelegateGenerator\RuntimeCreationTests.ComplexFormBinding.cs (7)
22var httpContext = CreateHttpContext(); 54var httpContext = CreateHttpContext(); 90var httpContext = CreateHttpContext(); 123var httpContext = CreateHttpContext(); 160var httpContext = CreateHttpContext(); 199var httpContext = CreateHttpContext(); 232var httpContext = CreateHttpContext();
RequestDelegateGenerator\RuntimeCreationTests.cs (2)
39var httpContext = CreateHttpContext(); 53var httpContext = CreateHttpContext();
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)
RequestTimeoutsMiddlewareBenchmark.cs (7)
62var context = CreateHttpContext(new Endpoint(null, null, null)); 69var context = CreateHttpContext(new Endpoint(null, null, null)); 77var context = CreateHttpContext(new Endpoint( 88var context = CreateHttpContext(new Endpoint( 99var context = CreateHttpContext(new Endpoint( 110var context = CreateHttpContext(new Endpoint(null, null, null)); 115private HttpContext CreateHttpContext(Endpoint endpoint)
src\Http\Http.Extensions\test\RequestDelegateGenerator\RequestDelegateCreationTestBase.cs (7)
197internal HttpContext CreateHttpContext(IServiceProvider serviceProvider = null) 219internal HttpContext CreateHttpContextWithBody(Todo requestData, IServiceProvider serviceProvider = null) 221var httpContext = CreateHttpContext(serviceProvider); 232internal static async Task<string> GetResponseBodyAsync(HttpContext httpContext) 240internal static async Task VerifyResponseJsonBodyAsync<T>(HttpContext httpContext, Action<T> check, int expectedStatusCode = 200) 252internal static async Task VerifyResponseJsonNodeAsync(HttpContext httpContext, Action<JsonNode> check, int expectedStatusCode = 200, string expectedContentType = "application/json; charset=utf-8") 262internal static async Task VerifyResponseBodyAsync(HttpContext httpContext, string expectedBody, int expectedStatusCode = 200)
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 (71)
Accepted.cs (1)
59public Task ExecuteAsync(HttpContext httpContext)
AcceptedAtRoute.cs (1)
77public Task ExecuteAsync(HttpContext httpContext)
AcceptedAtRouteOfT.cs (1)
91public Task ExecuteAsync(HttpContext httpContext)
AcceptedOfT.cs (1)
75public Task ExecuteAsync(HttpContext httpContext)
BadRequest.cs (1)
34public Task ExecuteAsync(HttpContext httpContext)
BadRequestOfT.cs (1)
45public Task ExecuteAsync(HttpContext httpContext)
ChallengeHttpResult.cs (1)
70public async Task ExecuteAsync(HttpContext httpContext)
Conflict.cs (1)
34public Task ExecuteAsync(HttpContext httpContext)
ConflictOfT.cs (1)
45public Task ExecuteAsync(HttpContext httpContext)
ContentHttpResult.cs (2)
56/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 58public Task ExecuteAsync(HttpContext httpContext)
Created.cs (1)
59public Task ExecuteAsync(HttpContext httpContext)
CreatedAtRoute.cs (1)
77public Task ExecuteAsync(HttpContext httpContext)
CreatedAtRouteOfT.cs (1)
91public Task ExecuteAsync(HttpContext httpContext)
CreatedOfT.cs (1)
74public Task ExecuteAsync(HttpContext httpContext)
FileContentHttpResult.cs (1)
107public Task ExecuteAsync(HttpContext httpContext)
FileStreamHttpResult.cs (1)
113public async Task ExecuteAsync(HttpContext httpContext)
ForbidHttpResult.cs (1)
81public async Task ExecuteAsync(HttpContext httpContext)
HttpResultsHelper.cs (4)
26HttpContext httpContext, 64HttpContext httpContext, 92HttpContext httpContext, 150private static JsonOptions ResolveJsonOptions(HttpContext httpContext)
InternalServerError.cs (1)
34public Task ExecuteAsync(HttpContext httpContext)
InternalServerErrorOfT.cs (1)
45public Task ExecuteAsync(HttpContext httpContext)
JsonHttpResultOfT.cs (1)
89public Task ExecuteAsync(HttpContext httpContext)
NoContent.cs (1)
33public Task ExecuteAsync(HttpContext httpContext)
NotFound.cs (1)
33public Task ExecuteAsync(HttpContext httpContext)
NotFoundOfT.cs (1)
44public Task ExecuteAsync(HttpContext httpContext)
Ok.cs (1)
33public Task ExecuteAsync(HttpContext httpContext)
OkOfT.cs (1)
44public Task ExecuteAsync(HttpContext httpContext)
PhysicalFileHttpResult.cs (2)
108public Task ExecuteAsync(HttpContext httpContext) 140private static Task ExecuteCoreAsync(HttpContext httpContext, RangeItemHeaderValue? range, long rangeLength, string fileName)
ProblemHttpResult.cs (1)
49public async Task ExecuteAsync(HttpContext httpContext)
PushStreamHttpResult.cs (1)
101public Task ExecuteAsync(HttpContext httpContext)
RedirectHttpResult.cs (1)
89public Task ExecuteAsync(HttpContext httpContext)
RedirectToRouteHttpResult.cs (1)
157public Task ExecuteAsync(HttpContext httpContext)
Results.cs (4)
27/// Creates an <see cref="IResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.ChallengeAsync(HttpContext, string?, AuthenticationProperties?)" />. 44/// Creates a <see cref="IResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.ForbidAsync(HttpContext, string?, AuthenticationProperties?)"/>. 62/// Creates an <see cref="IResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.SignInAsync(HttpContext, string?, ClaimsPrincipal, AuthenticationProperties?)" />. 75/// Creates an <see cref="IResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.SignOutAsync(HttpContext, string?, AuthenticationProperties?)" />.
ResultsOfT.Generated.cs (5)
40public Task ExecuteAsync(HttpContext httpContext) 104public Task ExecuteAsync(HttpContext httpContext) 177public Task ExecuteAsync(HttpContext httpContext) 259public Task ExecuteAsync(HttpContext httpContext) 350public Task ExecuteAsync(HttpContext httpContext)
SignInHttpResult.cs (1)
56public Task ExecuteAsync(HttpContext httpContext)
SignOutHttpResult.cs (1)
70public async Task ExecuteAsync(HttpContext httpContext)
src\Shared\RangeHelper\RangeHelper.cs (4)
18/// Provides a parser for the Range Header in an <see cref="HttpContext.Request"/>. 23/// Returns the normalized form of the requested range if the Range Header in the <see cref="HttpContext.Request"/> is valid. 25/// <param name="context">The <see cref="HttpContext"/> associated with the request.</param> 35HttpContext context,
src\Shared\ResultsHelpers\FileResultHelper.cs (5)
29internal static async Task WriteFileAsync(HttpContext context, Stream fileStream, RangeItemHeaderValue? range, long rangeLength) 56internal static async Task WriteFileAsync(HttpContext context, ReadOnlyMemory<byte> buffer, RangeItemHeaderValue? range, long rangeLength) 91HttpContext httpContext, 287HttpContext httpContext, 343private static void SetContentDispositionHeader(HttpContext httpContext, in FileResultInfo result)
src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
14internal static string? Content(HttpContext httpContext, string? contentPath)
StatusCodeHttpResult.cs (2)
35/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 37public Task ExecuteAsync(HttpContext httpContext)
TypedResults.cs (4)
27/// Creates a <see cref="ChallengeHttpResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.ChallengeAsync(HttpContext, string?, AuthenticationProperties?)" />. 44/// Creates a <see cref="ForbidHttpResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.ForbidAsync(HttpContext, string?, AuthenticationProperties?)"/>. 62/// Creates a <see cref="SignInHttpResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.SignInAsync(HttpContext, string?, ClaimsPrincipal, AuthenticationProperties?)" />. 79/// Creates a <see cref="SignOutHttpResult"/> that on execution invokes <see cref="AuthenticationHttpContextExtensions.SignOutAsync(HttpContext, string?, AuthenticationProperties?)" />.
UnauthorizedHttpResult.cs (1)
30public Task ExecuteAsync(HttpContext httpContext)
UnprocessableEntity.cs (1)
34public Task ExecuteAsync(HttpContext httpContext)
UnprocessableEntityOfT.cs (1)
45public Task ExecuteAsync(HttpContext httpContext)
Utf8ContentHttpResult.cs (2)
47/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 49public Task ExecuteAsync(HttpContext httpContext)
ValidationProblem.cs (1)
52public async Task ExecuteAsync(HttpContext httpContext)
VirtualFileHttpResult.cs (2)
102public Task ExecuteAsync(HttpContext httpContext) 135private static Task ExecuteCoreAsync(HttpContext httpContext, RangeItemHeaderValue? range, long rangeLength, IFileInfo fileInfo)
Microsoft.AspNetCore.Http.Results.Tests (234)
AcceptedAtRouteOfTResultTests.cs (5)
41var httpContext = GetHttpContext(linkGenerator); 91var httpContext = GetHttpContext(linkGenerator); 108var httpContext = GetHttpContext(linkGenerator); 144HttpContext httpContext = null; 212private static HttpContext GetHttpContext(LinkGenerator linkGenerator)
AcceptedAtRouteResultTests.cs (4)
45var httpContext = GetHttpContext(linkGenerator); 62var httpContext = GetHttpContext(linkGenerator); 97HttpContext httpContext = null; 122private static HttpContext GetHttpContext(LinkGenerator linkGenerator)
AcceptedOfTResultTests.cs (4)
20var httpContext = GetHttpContext(); 37var httpContext = GetHttpContext(); 85HttpContext httpContext = null; 136private static HttpContext GetHttpContext()
AcceptedResultTests.cs (3)
21var httpContext = GetHttpContext(); 54HttpContext httpContext = null; 79private static HttpContext GetHttpContext()
BadRequestOfTResultTests.cs (1)
128HttpContext httpContext = null;
BadRequestResultTests.cs (1)
67HttpContext httpContext = null;
ChallengeResultTests.cs (1)
49HttpContext httpContext = null;
ConflictOfTResultTests.cs (1)
106HttpContext httpContext = null;
ConflictResultTests.cs (1)
68HttpContext httpContext = null;
ContentResultTests.cs (4)
24var httpContext = GetHttpContext(); 111var httpContext = GetHttpContext(); 131HttpContext httpContext = null; 178private static HttpContext GetHttpContext()
CreatedAtRouteOfTResultTests.cs (4)
61var httpContext = GetHttpContext(linkGenerator); 78var httpContext = GetHttpContext(linkGenerator); 114HttpContext httpContext = null; 179private static HttpContext GetHttpContext(LinkGenerator linkGenerator)
CreatedAtRouteResultTests.cs (4)
44var httpContext = GetHttpContext(linkGenerator); 61var httpContext = GetHttpContext(linkGenerator); 95HttpContext httpContext = null; 125private static HttpContext GetHttpContext(LinkGenerator linkGenerator)
CreatedOfTResultTests.cs (5)
50var httpContext = GetHttpContext(); 66var httpContext = GetHttpContext(); 83var httpContext = GetHttpContext(); 120HttpContext httpContext = null; 176private static HttpContext GetHttpContext()
CreatedResultTests.cs (4)
35var httpContext = GetHttpContext(); 51var httpContext = GetHttpContext(); 85HttpContext httpContext = null; 113private static HttpContext GetHttpContext()
EmptyResultTests.cs (3)
17var httpContext = GetHttpContext(); 31HttpContext httpContext = null; 37private static HttpContext GetHttpContext()
FileContentResultTests.cs (1)
15HttpContext httpContext,
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;
HttpFileStreamResultTests.cs (2)
12HttpContext httpContext, 86HttpContext httpContext = null;
InternalServerErrorOfTResultTests.cs (1)
128HttpContext httpContext = null;
InternalServerErrorResultTests.cs (1)
67HttpContext httpContext = null;
JsonResultTests.cs (1)
248HttpContext httpContext = null;
LocalRedirectResultTests.cs (4)
65var httpContext = GetHttpContext(appRoot); 88var httpContext = GetHttpContext(appRoot); 109var httpContext = GetHttpContext(appRoot); 128private static HttpContext GetHttpContext(string appRoot)
NoContentResultTests.cs (3)
33var httpContext = GetHttpContext(); 64HttpContext httpContext = null; 97private static HttpContext GetHttpContext()
NotFoundOfTResultTests.cs (3)
55var httpContext = GetHttpContext(); 88HttpContext httpContext = null; 139private static HttpContext GetHttpContext()
NotFoundResultTests.cs (3)
31var httpContext = GetHttpContext(); 63HttpContext httpContext = null; 88private static HttpContext GetHttpContext()
OkOfTResultTests.cs (1)
105HttpContext httpContext = null;
OkResultTests.cs (1)
66HttpContext httpContext = null;
PhysicalFileResultTest.cs (1)
12HttpContext httpContext,
ProblemResultTests.cs (1)
196HttpContext httpContext = null;
PushStreamResultTests.cs (1)
75HttpContext httpContext = null;
RedirectResultTests.cs (2)
30HttpContext httpContext = null; 86protected override Task ExecuteAsync(HttpContext httpContext, string contentPath)
RedirectToRouteResultTests.cs (5)
39var httpContext = GetHttpContext(locationUrl); 57var httpContext = GetHttpContext(expectedUrl); 76var httpContext = GetHttpContext(expectedUrl); 92HttpContext httpContext = null; 98private static HttpContext GetHttpContext(string path)
ResultsOfTTests.cs (1)
61private static HttpContext GetHttpContext()
ResultsOfTTests.Generated.cs (63)
52var httpContext = GetHttpContext(); 70HttpContext httpContext = null; 89var httpContext = GetHttpContext(); 114var httpContext = GetHttpContext(); 139var httpContext = GetHttpContext(); 166var httpContext = GetHttpContext(); 193var httpContext = GetHttpContext(); 267var httpContext = GetHttpContext(); 285HttpContext httpContext = null; 304var httpContext = GetHttpContext(); 331var httpContext = GetHttpContext(); 358var httpContext = GetHttpContext(); 385var httpContext = GetHttpContext(); 414var httpContext = GetHttpContext(); 443var httpContext = GetHttpContext(); 472var httpContext = GetHttpContext(); 551var httpContext = GetHttpContext(); 569HttpContext httpContext = null; 588var httpContext = GetHttpContext(); 617var httpContext = GetHttpContext(); 646var httpContext = GetHttpContext(); 675var httpContext = GetHttpContext(); 704var httpContext = GetHttpContext(); 735var httpContext = GetHttpContext(); 766var httpContext = GetHttpContext(); 797var httpContext = GetHttpContext(); 828var httpContext = GetHttpContext(); 912var httpContext = GetHttpContext(); 930HttpContext httpContext = null; 949var httpContext = GetHttpContext(); 980var httpContext = GetHttpContext(); 1011var httpContext = GetHttpContext(); 1042var httpContext = GetHttpContext(); 1073var httpContext = GetHttpContext(); 1104var httpContext = GetHttpContext(); 1137var httpContext = GetHttpContext(); 1170var httpContext = GetHttpContext(); 1203var httpContext = GetHttpContext(); 1236var httpContext = GetHttpContext(); 1269var httpContext = GetHttpContext(); 1358var httpContext = GetHttpContext(); 1376HttpContext httpContext = null; 1395var httpContext = GetHttpContext(); 1428var httpContext = GetHttpContext(); 1461var httpContext = GetHttpContext(); 1494var httpContext = GetHttpContext(); 1527var httpContext = GetHttpContext(); 1560var httpContext = GetHttpContext(); 1593var httpContext = GetHttpContext(); 1628var httpContext = GetHttpContext(); 1663var httpContext = GetHttpContext(); 1698var httpContext = GetHttpContext(); 1733var httpContext = GetHttpContext(); 1768var httpContext = GetHttpContext(); 1803var httpContext = GetHttpContext(); 1850public Task ExecuteAsync(HttpContext httpContext) 1863public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1877public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1891public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1905public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1919public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1933public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask; 1946public Task ExecuteAsync(HttpContext httpContext) => Task.CompletedTask;
SignInResultTests.cs (4)
22.Setup(c => c.SignInAsync(It.IsAny<HttpContext>(), "", principal, null)) 43.Setup(c => c.SignInAsync(It.IsAny<HttpContext>(), null, principal, null)) 64.Setup(c => c.SignInAsync(It.IsAny<HttpContext>(), "Scheme1", principal, authProperties)) 82HttpContext httpContext = null;
SignOutResultTests.cs (5)
20.Setup(c => c.SignOutAsync(It.IsAny<HttpContext>(), null, null)) 39.Setup(c => c.SignOutAsync(It.IsAny<HttpContext>(), "", null)) 59.Setup(c => c.SignOutAsync(It.IsAny<HttpContext>(), "Scheme1", authProperties)) 63.Setup(c => c.SignOutAsync(It.IsAny<HttpContext>(), "Scheme2", authProperties)) 81HttpContext httpContext = null;
src\Shared\ResultsTests\FileContentResultTestBase.cs (12)
20HttpContext httpContext, 32var httpContext = GetHttpContext(); 61var httpContext = GetHttpContext(); 100var httpContext = GetHttpContext(); 139var httpContext = GetHttpContext(); 173var httpContext = GetHttpContext(); 210var httpContext = GetHttpContext(); 241var httpContext = GetHttpContext(); 273var httpContext = GetHttpContext(); 307var httpContext = GetHttpContext(); 340var httpContext = GetHttpContext(); 361private static HttpContext GetHttpContext()
src\Shared\ResultsTests\FileStreamResultTestBase.cs (14)
17HttpContext httpContext, 39var httpContext = GetHttpContext(); 81var httpContext = GetHttpContext(); 122var httpContext = GetHttpContext(); 159var httpContext = GetHttpContext(); 198var httpContext = GetHttpContext(); 231var httpContext = GetHttpContext(); 265var httpContext = GetHttpContext(); 301var httpContext = GetHttpContext(); 342var httpContext = GetHttpContext(); 382var httpContext = GetHttpContext(); 407var httpContext = GetHttpContext(); 427var httpContext = GetHttpContext(); 449private static HttpContext GetHttpContext()
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (17)
23HttpContext httpContext, 40var httpContext = GetHttpContext(); 72var httpContext = GetHttpContext(); 104var httpContext = GetHttpContext(); 131var httpContext = GetHttpContext(); 160var httpContext = GetHttpContext(); 187var httpContext = GetHttpContext(); 216var httpContext = GetHttpContext(); 243var httpContext = GetHttpContext(); 276var httpContext = GetHttpContext(); 296var httpContext = GetHttpContext(); 329var httpContext = GetHttpContext(); 350var httpContext = GetHttpContext(); 380var httpContext = GetHttpContext(); 402var httpContext = GetHttpContext(); 415var httpContext = GetHttpContext(); 466private static HttpContext GetHttpContext()
src\Shared\ResultsTests\RedirectResultTestBase.cs (4)
16protected abstract Task ExecuteAsync(HttpContext httpContext, string contentPath); 27var httpContext = GetHttpContext(appRoot); 50var httpContext = GetHttpContext(appRoot); 69private static HttpContext GetHttpContext(
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (17)
26HttpContext httpContext, 51var httpContext = GetHttpContext(GetFileProvider(path)); 88var httpContext = GetHttpContext(GetFileProvider(path)); 125var httpContext = GetHttpContext(GetFileProvider(path)); 158var httpContext = GetHttpContext(GetFileProvider(path)); 194var httpContext = GetHttpContext(GetFileProvider(path)); 227var httpContext = GetHttpContext(GetFileProvider(path)); 264var httpContext = GetHttpContext(GetFileProvider(path)); 295var httpContext = GetHttpContext(GetFileProvider(path)); 327var httpContext = GetHttpContext(GetFileProvider(path)); 364var httpContext = GetHttpContext(GetFileProvider("FilePathResultTestFile_ASCII.txt")); 382var httpContext = GetHttpContext(GetFileProvider(path)); 404var httpContext = GetHttpContext(webRootFileProvider); 427var httpContext = GetHttpContext(webRootFileProvider); 452var httpContext = GetHttpContext(nonDiskFileProvider.Object); 475var httpContext = GetHttpContext(fileProvider.Object); 498private static HttpContext GetHttpContext(IFileProvider webRootFileProvider)
StatusCodeResultTests.cs (3)
18var httpContext = GetHttpContext(); 32HttpContext httpContext = null; 54private static HttpContext GetHttpContext()
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)
UnauthorizedResultTests.cs (3)
28var httpContext = GetHttpContext(); 42HttpContext httpContext = null; 64private static HttpContext GetHttpContext()
UnprocessableEntityOfTResultTests.cs (1)
105HttpContext httpContext = null;
UnprocessableEntityResultTests.cs (1)
67HttpContext httpContext = null;
Utf8ContentResultTests.cs (3)
35var context = GetHttpContext(); 53var context = GetHttpContext(); 96private static HttpContext GetHttpContext()
ValidationProblemResultTests.cs (1)
116HttpContext httpContext = null;
VirtualFileResultTests.cs (1)
11protected override Task ExecuteAsync(HttpContext httpContext, string path, string contentType, DateTimeOffset? lastModified = null, EntityTagHeaderValue entityTag = null, bool enableRangeProcessing = false)
Microsoft.AspNetCore.Http.Tests (6)
ApplicationBuilderTests.cs (1)
113builder.Use((HttpContext context, RequestDelegate next) =>
DefaultHttpContextTests.cs (3)
324void TestAllCachedFeaturesAreNull(HttpContext context, IFeatureCollection features) 352void TestAllCachedFeaturesAreSet(HttpContext context, IFeatureCollection features) 411private HttpContext CreateContext()
Timeouts\RequestTimeoutsMiddlewareTests.cs (2)
323Task next(HttpContext context) 362public (CancellationTokenSource linkedCts, CancellationTokenSource timeoutCts) GetLinkedCancellationTokenSource(HttpContext httpContext, CancellationToken originalToken, TimeSpan timeSpan)
Microsoft.AspNetCore.HttpLogging (5)
HttpLoggingInterceptorContext.cs (2)
23private HttpContext? _httpContext; 31public HttpContext HttpContext
HttpLoggingMiddleware.cs (2)
49public Task Invoke(HttpContext context) 70private async Task InvokeInternal(HttpContext context, HttpLoggingOptions options,
W3CLoggingMiddleware.cs (1)
70public async Task Invoke(HttpContext context)
Microsoft.AspNetCore.HttpLogging.Tests (10)
HttpLoggingMiddlewareTests.cs (10)
1925endpoint.MapGet("/", async (HttpContext c) => 1988private static async Task RequestResponseApp(HttpContext context) 2031endpoint.MapGet("/attr_responseonly", [HttpLogging(HttpLoggingFields.Response)] async (HttpContext c) => 2037endpoint.MapGet("/ext_responseonly", async (HttpContext c) => 2043endpoint.MapGet("/attr_responseandrequest", [HttpLogging(HttpLoggingFields.All)] async (HttpContext c) => 2050endpoint.MapGet("/ext_responseandrequest", async(HttpContext c) => 2056endpoint.MapGet("/attr_restrictedheaders", [HttpLogging((HttpLoggingFields.Request & ~HttpLoggingFields.RequestScheme) | (HttpLoggingFields.Response & ~HttpLoggingFields.ResponseStatusCode))] async (HttpContext c) => 2062endpoint.MapGet("/ext_restrictedheaders", async (HttpContext c) => 2068endpoint.MapGet("/attr_restrictedsize", [HttpLogging(HttpLoggingFields.RequestBody | HttpLoggingFields.ResponseBody, RequestBodyLogLimit = 3, ResponseBodyLogLimit = 6)] async (HttpContext c) => 2074endpoint.MapGet("/ext_restrictedsize", async (HttpContext c) =>
Microsoft.AspNetCore.HttpOverrides (10)
CertificateForwardingMiddleware.cs (2)
45/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 47public Task Invoke(HttpContext httpContext)
ForwardedHeadersMiddleware.cs (5)
109/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 110public Task Invoke(HttpContext context) 117/// Forward the proxied headers to the given <see cref="HttpContext"/>. 119/// <param name="context">The <see cref="HttpContext"/>.</param> 120public void ApplyForwarders(HttpContext context)
HttpMethodOverrideMiddleware.cs (3)
35/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 36public Task Invoke(HttpContext context) 59private async Task InvokeCore(HttpContext context)
Microsoft.AspNetCore.HttpOverrides.Tests (30)
CertificateForwardingTest.cs (5)
69var context = await server.SendAsync(c => 108var context = await server.SendAsync(c => 146var context = await server.SendAsync(c => 184var context = await server.SendAsync(c => 222var context = await server.SendAsync(c =>
ForwardedHeadersMiddlewareTest.cs (25)
38var context = await server.SendAsync(c => 74var context = await server.SendAsync(c => 132var context = await server.SendAsync(c => 170var context = await server.SendAsync(c => 243var context = await server.SendAsync(c => 275var context = await server.SendAsync(c => 304var context = await server.SendAsync(c => 511var response = await server.SendAsync(ctx => 562var response = await server.SendAsync(ctx => 598var response = await server.SendAsync(ctx => 634var context = await server.SendAsync(c => 783var context = await server.SendAsync(c => 825var context = await server.SendAsync(c => 875var context = await server.SendAsync(c => 916var context = await server.SendAsync(c => 951var context = await server.SendAsync(c => 986var context = await server.SendAsync(c => 1040var context = await server.SendAsync(c => 1079var context = await server.SendAsync(c => 1116var context = await server.SendAsync(c => 1155var context = await server.SendAsync(c => 1197var context = await server.SendAsync(c => 1233var context = await server.SendAsync(c => 1277var context = await server.SendAsync(c => 1323var context = await server.SendAsync(c =>
Microsoft.AspNetCore.HttpsPolicy (3)
HstsMiddleware.cs (2)
60/// <param name="context">The <see cref="HttpContext"/>.</param> 62public Task Invoke(HttpContext context)
HttpsRedirectionMiddleware.cs (1)
78public Task Invoke(HttpContext context)
Microsoft.AspNetCore.Identity (10)
AspNetRoleManager.cs (1)
25/// <param name="contextAccessor">The accessor used to access the <see cref="HttpContext"/>.</param>
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)
SignInManager.cs (5)
27private HttpContext? _context; 34/// <param name="contextAccessor">The accessor used to access the <see cref="HttpContext"/>.</param> 90/// The <see cref="HttpContext"/> used. 92public HttpContext Context 96var context = _context ?? _contextAccessor?.HttpContext;
Microsoft.AspNetCore.Identity.InMemory.Test (2)
ControllerTest.cs (1)
108private Mock<IAuthenticationService> MockAuth(HttpContext context)
FunctionalTest.cs (1)
291private async Task<TestServer> CreateServer(Action<IServiceCollection> configureServices = null, Func<HttpContext, Task> testpath = null, Uri baseAddress = null, bool testCore = false)
Microsoft.AspNetCore.Identity.Test (21)
SecurityStampValidatorTest.cs (10)
41public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context) 60var httpContext = new Mock<HttpContext>(); 74var httpContext = new Mock<HttpContext>(); 95private async Task RunApplicationCookieTest(PocoUser user, Mock<HttpContext> httpContext, bool shouldStampValidate, Func<Task> testCode) 134var httpContext = new Mock<HttpContext>(); 157var httpContext = new Mock<HttpContext>(); 200var httpContext = new Mock<HttpContext>(); 239var httpContext = new Mock<HttpContext>(); 276var httpContext = new Mock<HttpContext>(); 323var httpContext = new Mock<HttpContext>();
SignInManagerTest.cs (11)
25var context = new Mock<HttpContext>(); 39var context = new Mock<HttpContext>(); 69var context = new Mock<HttpContext>(); 100private static SignInManager<PocoUser> SetupSignInManager(UserManager<PocoUser> manager, HttpContext context, ILogger logger = null, IdentityOptions identityOptions = null, IAuthenticationSchemeProvider schemeProvider = null) 805private Mock<IAuthenticationService> MockAuth(HttpContext context) 840var context = new Mock<HttpContext>(); 862var context = new Mock<HttpContext>(); 889var context = new Mock<HttpContext>(); 916var context = new Mock<HttpContext>(); 975private static void SetupSignIn(HttpContext context, Mock<IAuthenticationService> auth, string userId = null, bool? isPersistent = null, string loginProvider = null, string amr = null) 1279private static SignInManager<PocoUser> SetupSignInManagerType(UserManager<PocoUser> manager, HttpContext context, string typeName)
Microsoft.AspNetCore.Localization (11)
AcceptLanguageHeaderRequestCultureProvider.cs (1)
23public override Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext)
CookieRequestCultureProvider.cs (1)
29public override Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext)
CustomRequestCultureProvider.cs (3)
13private readonly Func<HttpContext, Task<ProviderCultureResult?>> _provider; 19public CustomRequestCultureProvider(Func<HttpContext, Task<ProviderCultureResult?>> provider) 27public override Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext)
IRequestCultureProvider.cs (2)
16/// <param name="httpContext">The <see cref="HttpContext"/> for the request.</param> 21Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext);
QueryStringRequestCultureProvider.cs (1)
27public override Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext)
RequestCultureProvider.cs (1)
26public abstract Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext);
RequestLocalizationMiddleware.cs (2)
45/// <param name="context">The <see cref="HttpContext"/>.</param> 47public async Task Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.Routing (1)
RouteDataRequestCultureProvider.cs (1)
28public override Task<ProviderCultureResult?> DetermineProviderCultureResult(HttpContext httpContext)
Microsoft.AspNetCore.Localization.Tests (1)
CustomRequestCultureProviderTest.cs (1)
64private static string GetCultureInfoFromUrl(HttpContext context, IList<CultureInfo> supportedCultures)
Microsoft.AspNetCore.MiddlewareAnalysis (2)
AnalysisMiddleware.cs (2)
43/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 44public async Task Invoke(HttpContext httpContext)
Microsoft.AspNetCore.MiddlewareAnalysis.Tests (2)
TestDiagnosticListener.cs (2)
16public virtual void OnMiddlewareStarting(HttpContext httpContext, string name) 28public virtual void OnMiddlewareFinished(HttpContext httpContext, string name)
Microsoft.AspNetCore.Mvc.Abstractions (26)
ActionConstraints\ActionConstraintProviderContext.cs (4)
17/// <param name="context">The <see cref="Http.HttpContext"/> associated with the request.</param> 21HttpContext context, 35/// The <see cref="Http.HttpContext"/> associated with the request. 37public HttpContext HttpContext { get; }
ActionContext.cs (6)
43/// <param name="httpContext">The <see cref="Http.HttpContext"/> for the current request.</param> 47HttpContext httpContext, 57/// <param name="httpContext">The <see cref="Http.HttpContext"/> for the current request.</param> 62HttpContext httpContext, 87/// Gets or sets the <see cref="Http.HttpContext"/> for the current request. 92public HttpContext HttpContext { get; set; } = default!;
Formatters\InputFormatterContext.cs (6)
19/// The <see cref="Http.HttpContext"/> for the current operation. 32HttpContext httpContext, 45/// The <see cref="Http.HttpContext"/> for the current operation. 61HttpContext httpContext, 93/// Gets the <see cref="Http.HttpContext"/> associated with the current operation. 95public HttpContext HttpContext { get; }
Formatters\OutputFormatterCanWriteContext.cs (2)
18protected OutputFormatterCanWriteContext(HttpContext httpContext) 28public virtual HttpContext HttpContext { get; protected set; }
Formatters\OutputFormatterWriteContext.cs (2)
17/// <param name="httpContext">The <see cref="Http.HttpContext"/> for the current request.</param> 21public OutputFormatterWriteContext(HttpContext httpContext, Func<Stream, Encoding, TextWriter> writerFactory, Type? objectType, object? @object)
ModelBinding\ModelBindingContext.cs (2)
39/// Gets the <see cref="Http.HttpContext"/> associated with this context. 41public virtual HttpContext HttpContext => ActionContext?.HttpContext!;
src\Shared\ParameterBindingMethodCache.cs (4)
39internal static readonly ParameterExpression HttpContextExpr = Expression.Parameter(typeof(HttpContext), "httpContext"); 226methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext), typeof(ParameterInfo) }, ValidateReturnType); 231methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext) }, ValidateReturnType); 424private static ValueTask<TValue?> BindAsync<TValue>(HttpContext httpContext, ParameterInfo parameter)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
EndpointMetadataApiDescriptionProvider.cs (1)
278parameterType == typeof(HttpContext) ||
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (8)
EndpointMetadataApiDescriptionProviderTest.cs (8)
584Assert.Empty(GetApiDescription((HttpContext context) => { }).ParameterDescriptions); 1646public static ValueTask<BindAsyncRecord> BindAsync(HttpContext context, ParameterInfo parameter) => 1652private record ArgumentListRecord([FromRoute] int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context); 1654private record struct ArgumentListRecordStruct([FromRoute] int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context); 1656private record ArgumentListRecordWithoutAttributes(int Foo, int Bar, InferredJsonClass? FromBody, HttpContext context); 1664public HttpContext Context { get; set; } = null!; 1673public HttpContext Context { get; set; } = null!; 1687public HttpContext Context { get; set; }
Microsoft.AspNetCore.Mvc.Core (97)
ActionConstraints\ActionConstraintCache.cs (3)
45public IReadOnlyList<IActionConstraint>? GetActionConstraints(HttpContext httpContext, ActionDescriptor action) 93private IReadOnlyList<IActionConstraint>? GetActionConstraintsFromEntry(CacheEntry entry, HttpContext httpContext, ActionDescriptor action) 121private void ExecuteProviders(HttpContext httpContext, ActionDescriptor action, List<ActionConstraintItem> items)
CacheProfile.cs (4)
15/// <see cref="Microsoft.AspNetCore.Http.HttpContext.Response" />. 22/// the "Cache-control" header is set in the <see cref="Microsoft.AspNetCore.Http.HttpContext.Response" />. 29/// <see cref="Microsoft.AspNetCore.Http.HttpContext.Response" /> to "no-store". 36/// Gets or sets the value for the Vary header in <see cref="Microsoft.AspNetCore.Http.HttpContext.Response" />.
ChallengeResult.cs (1)
95var httpContext = context.HttpContext;
ControllerBase.cs (2)
35/// Gets the <see cref="Http.HttpContext"/> for the executing action. 37public HttpContext HttpContext => ControllerContext.HttpContext;
ControllerContext.cs (2)
49/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 53HttpContext httpContext,
Diagnostics\MvcDiagnostics.cs (4)
27public BeforeActionEventData(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) 42public HttpContext HttpContext { get; } 78public AfterActionEventData(ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) 93public HttpContext HttpContext { get; }
Filters\IMiddlewareFilterFeature.cs (1)
7/// A feature in <see cref="Microsoft.AspNetCore.Http.HttpContext.Features"/> which is used to capture the
Filters\MiddlewareFilter.cs (1)
24var httpContext = context.HttpContext;
ForbidResult.cs (1)
95var httpContext = context.HttpContext;
Formatters\SystemTextJsonInputFormatter.cs (2)
60var httpContext = context.HttpContext; 126private static (Stream inputStream, bool usesTranscodingStream) GetInputStream(HttpContext httpContext, Encoding encoding)
Formatters\SystemTextJsonOutputFormatter.cs (1)
66var httpContext = context.HttpContext;
Infrastructure\ControllerEndpointFilterInvocationContext.cs (1)
40public override HttpContext HttpContext => ActionContext.HttpContext;
Infrastructure\DefaultProblemDetailsFactory.cs (3)
39HttpContext httpContext, 64HttpContext httpContext, 95private void ApplyProblemDetailsDefaults(HttpContext httpContext, ProblemDetails problemDetails, int statusCode)
Infrastructure\FileResultExecutorBase.cs (2)
89/// <param name="context">The <see cref="HttpContext"/>.</param> 94protected static async Task WriteFileAsync(HttpContext context, Stream fileStream, RangeItemHeaderValue? range, long rangeLength)
Infrastructure\PhysicalFileResultExecutor.cs (1)
64HttpContext httpContext,
Infrastructure\ProblemDetailsFactory.cs (4)
17/// <param name="httpContext">The <see cref="HttpContext" />.</param> 25HttpContext httpContext, 35/// <param name="httpContext">The <see cref="HttpContext" />.</param> 44HttpContext httpContext,
Infrastructure\VirtualFileResultExecutor.cs (1)
75HttpContext httpContext,
ModelBinding\Binders\BodyModelBinder.cs (1)
106var httpContext = bindingContext.HttpContext;
MvcCoreDiagnosticListenerExtensions.cs (4)
23HttpContext httpContext, 38private static void BeforeActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData) 51HttpContext httpContext, 66private static void AfterActionImpl(DiagnosticListener diagnosticListener, ActionDescriptor actionDescriptor, HttpContext httpContext, RouteData routeData)
Routing\ActionConstraintMatcherPolicy.cs (3)
76public Task ApplyAsync(HttpContext httpContext, CandidateSet candidateSet) 103HttpContext httpContext, 155HttpContext httpContext,
Routing\ControllerLinkGeneratorExtensions.cs (6)
20/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 42HttpContext httpContext, 100/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 136HttpContext httpContext, 206private static RouteValuesAddress CreateAddress(HttpContext? httpContext, string? action, string? controller, object? values) 220private static RouteValueDictionary? GetAmbientValues(HttpContext? httpContext)
Routing\DynamicControllerEndpointMatcherPolicy.cs (1)
58public async Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
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)
Routing\KnownRouteValueConstraint.cs (2)
35HttpContext? httpContext, 65private ActionDescriptorCollection GetAndValidateActionDescriptors(HttpContext? httpContext)
Routing\PageLinkGeneratorExtensions.cs (6)
20/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 41HttpContext httpContext, 102/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 137HttpContext httpContext, 206private static RouteValuesAddress CreateAddress(HttpContext? httpContext, string? page, string? handler, object? values) 220private static RouteValueDictionary? GetAmbientValues(HttpContext? httpContext)
Routing\UrlHelper.cs (2)
26/// Gets the <see cref="Http.HttpContext"/> associated with the current request. 28protected HttpContext HttpContext => ActionContext.HttpContext;
Routing\UrlHelperBase.cs (2)
296internal static string? Content(HttpContext httpContext, string? contentPath) 405nameof(HttpContext)));
Routing\UrlHelperFactory.cs (3)
21var httpContext = context.HttpContext; 33nameof(HttpContext.Items), 34nameof(HttpContext)));
SignInResult.cs (1)
82var httpContext = context.HttpContext;
SignOutResult.cs (2)
98Task IResult.ExecuteAsync(HttpContext httpContext) 103private async Task ExecuteAsync(HttpContext httpContext)
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)
src\Shared\RangeHelper\RangeHelper.cs (4)
18/// Provides a parser for the Range Header in an <see cref="HttpContext.Request"/>. 23/// Returns the normalized form of the requested range if the Range Header in the <see cref="HttpContext.Request"/> is valid. 25/// <param name="context">The <see cref="HttpContext"/> associated with the request.</param> 35HttpContext context,
src\Shared\ResultsHelpers\FileResultHelper.cs (5)
29internal static async Task WriteFileAsync(HttpContext context, Stream fileStream, RangeItemHeaderValue? range, long rangeLength) 56internal static async Task WriteFileAsync(HttpContext context, ReadOnlyMemory<byte> buffer, RangeItemHeaderValue? range, long rangeLength) 91HttpContext httpContext, 287HttpContext httpContext, 343private static void SetContentDispositionHeader(HttpContext httpContext, in FileResultInfo result)
src\Shared\ResultsHelpers\SharedUrlHelper.cs (1)
14internal static string? Content(HttpContext httpContext, string? contentPath)
StatusCodeResult.cs (1)
38var httpContext = context.HttpContext;
UrlHelperExtensions.cs (2)
525var httpContext = helper.ActionContext.HttpContext; 574var httpContext = urlHelper.ActionContext.HttpContext;
Microsoft.AspNetCore.Mvc.Core.Test (296)
AcceptedAtActionResultTests.cs (5)
123var httpContext = GetHttpContext(formatter); 152var httpContext = GetHttpContext(formatter); 178var httpContext = GetHttpContext(formatter); 237private static ActionContext GetActionContext(HttpContext httpContext) 248private static HttpContext GetHttpContext(Mock<IOutputFormatter> formatter)
AcceptedAtRouteResultTests.cs (5)
54var httpContext = GetHttpContext(formatter); 108var httpContext = GetHttpContext(formatter); 127var httpContext = GetHttpContext(formatter); 145private static ActionContext GetActionContext(HttpContext httpContext) 156private static HttpContext GetHttpContext(Mock<IOutputFormatter> formatter)
AcceptedResultTests.cs (5)
50var httpContext = GetHttpContext(formatter); 72var httpContext = GetHttpContext(formatter); 90var httpContext = GetHttpContext(formatter); 103private static ActionContext GetActionContext(HttpContext httpContext) 113private static HttpContext GetHttpContext(Mock<IOutputFormatter> formatter)
ActionResultOfTTest.cs (1)
123public Task ExecuteAsync(HttpContext httpContext)
ApplicationModels\EndpointMetadataProviderTest.cs (2)
412public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException(); 451public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
Authorization\AuthorizeFilterTest.cs (1)
611var httpContext = new Mock<HttpContext>();
ChallengeResultTest.cs (2)
25var httpContext = new Mock<HttpContext>(); 50var httpContext = new Mock<HttpContext>();
ConsumesAttributeTests.cs (2)
405var httpContext = CreateHttpContext(contentType); 418private static HttpContext CreateHttpContext(string contentType = null, object routeValues = null)
ContentResultTest.cs (5)
35var httpContext = GetHttpContext(); 127var httpContext = GetHttpContext(); 230var httpContext = GetHttpContext(); 246private static ActionContext GetActionContext(HttpContext httpContext) 274private static HttpContext GetHttpContext()
ControllerBaseTest.cs (7)
1860var mockHttpContext = new Mock<HttpContext>(); 1887var mockHttpContext = new Mock<HttpContext>(); 1914var mockHttpContext = new Mock<HttpContext>(); 1940var mockHttpContext = new Mock<HttpContext>(); 2994var httpContext = new Mock<HttpContext>(); 3014var httpContext = new Mock<HttpContext>(); 3034var httpContext = new Mock<HttpContext>();
CreatedAtActionResultTests.cs (4)
25var httpContext = GetHttpContext(); 48var httpContext = GetHttpContext(); 66private static ActionContext GetActionContext(HttpContext httpContext) 75private static HttpContext GetHttpContext()
CreatedAtRouteResultTests.cs (4)
44var httpContext = GetHttpContext(); 62var httpContext = GetHttpContext(); 79private static ActionContext GetActionContext(HttpContext httpContext) 89private static HttpContext GetHttpContext()
CreatedResultTests.cs (5)
66var httpContext = GetHttpContext(); 82var httpContext = GetHttpContext(); 99var httpContext = GetHttpContext(); 112private static ActionContext GetActionContext(HttpContext httpContext) 122private static HttpContext GetHttpContext()
DependencyInjection\ApiBehaviorOptionsSetupTest.cs (1)
77var factory = Mock.Of<ProblemDetailsFactory>(m => m.CreateValidationProblemDetails(It.IsAny<HttpContext>(), It.IsAny<ModelStateDictionary>(), null, null, null, null, null) == new ValidationProblemDetails
EmptyResultTests.cs (1)
19var httpContext = new Mock<HttpContext>(MockBehavior.Strict);
FileContentResultTest.cs (1)
19HttpContext httpContext,
FileResultHelperTest.cs (8)
34var httpContext = GetHttpContext(); 56var httpContext = GetHttpContext(); 103var httpContext = GetHttpContext(); 225var httpContext = GetHttpContext(); 404var httpContext = GetHttpContext(); 442var httpContext = GetHttpContext(); 468private static HttpContext GetHttpContext() 478private static ActionContext CreateActionContext(HttpContext context)
FileStreamResultTest.cs (1)
17HttpContext httpContext,
Filters\MiddlewareFilterTest.cs (5)
30Task requestDelegate(HttpContext context) => Task.FromResult(true); 217private ResourceExecutingContext GetResourceExecutingContext(HttpContext httpContext) 225private ResourceExecutionDelegate GetResourceExecutionDelegate(HttpContext httpContext) 261var httpContext = GetHttpContext(); 307private static HttpContext GetHttpContext()
ForbidResultTest.cs (4)
21var httpContext = new Mock<HttpContext>(); 47var httpContext = new Mock<HttpContext>(); 86var httpContext = new Mock<HttpContext>(); 114var httpContext = new Mock<HttpContext>();
Formatters\FormatFilterTest.cs (7)
65var httpContext = new Mock<HttpContext>(); 327var httpContext = new Mock<HttpContext>(); 364var httpContext = new Mock<HttpContext>(); 393public HttpContext MockHttpContext { get; private set; } 400var httpContext = new Mock<HttpContext>(); 427Mock<HttpContext> httpContext, 453Mock<HttpContext> httpContext,
Formatters\JsonInputFormatterTestBase.cs (26)
39var httpContext = GetHttpContext(contentBytes, contentType: requestContentType); 71var httpContext = GetHttpContext(contentBytes); 92var httpContext = GetHttpContext(contentBytes); 113var httpContext = GetHttpContext(contentBytes, "application/json;charset=utf-16"); 137var httpContext = GetHttpContext(contentBytes); 165var httpContext = GetHttpContext(contentBytes); 192var httpContext = GetHttpContext(contentBytes); 219var httpContext = GetHttpContext(contentBytes); 240var httpContext = GetHttpContext(contentBytes); 262var httpContext = GetHttpContext(contentBytes); 294var httpContext = GetHttpContext(contentBytes); 315var httpContext = GetHttpContext(contentBytes); 342var httpContext = GetHttpContext(contentBytes); 368var httpContext = GetHttpContext(contentBytes); 394var httpContext = GetHttpContext(contentBytes); 421var httpContext = GetHttpContext(contentBytes); 451var httpContext = GetHttpContext(contentBytes); 475var httpContext = GetHttpContext(contentBytes); 501var httpContext = GetHttpContext(contentBytes); 525var httpContext = GetHttpContext(contentBytes); 545var httpContext = GetHttpContext(contentBytes); 568var httpContext = GetHttpContext(contentBytes); 592var httpContext = GetHttpContext(contentBytes); 629protected static HttpContext GetHttpContext( 636protected static HttpContext GetHttpContext( 650HttpContext httpContext,
Formatters\StringOutputFormatterTests.cs (1)
137var httpContext = new Mock<HttpContext>();
Formatters\SystemTextJsonInputFormatterTest.cs (5)
72var httpContext = GetHttpContext(contentBytes); 96var httpContext = GetHttpContext(contentBytes); 117var httpContext = GetHttpContext(contentBytes); 145var httpContext = GetHttpContext(contentBytes); 167var httpContext = GetHttpContext(contentBytes);
Formatters\TextOutputFormatterTests.cs (1)
41var httpContext = new Mock<HttpContext>();
HttpNotFoundObjectResultTest.cs (2)
40var httpContext = GetHttpContext(); 55private static HttpContext GetHttpContext()
HttpStatusCodeResultTests.cs (2)
22var httpContext = GetHttpContext(); 55private static HttpContext GetHttpContext()
Infrastructure\ActionResultTypeMapperTest.cs (1)
109public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException();
Infrastructure\ActionSelectorTest.cs (3)
1023private static HttpContext GetHttpContext(string httpMethod) 1092new Mock<HttpContext>(MockBehavior.Strict).Object, 1104var httpContext = new Mock<HttpContext>(MockBehavior.Strict);
Infrastructure\ControllerActionInvokerTest.cs (1)
1403var context = new Mock<HttpContext>();
Infrastructure\DefaultApiProblemDetailsWriterTest.cs (9)
24var context = CreateContext(stream); 60var context = CreateContext(stream); 99var context = CreateContext(stream); 127var context = CreateContext(stream, metadata: EndpointMetadataCollection.Empty); 142var context = CreateContext(stream, metadata: new EndpointMetadataCollection(new ControllerAttribute())); 157var context = CreateContext(stream, metadata: new EndpointMetadataCollection(new ControllerAttribute())); 173var context = CreateContext(stream); 191var context = CreateContext(stream); 201private static HttpContext CreateContext(Stream body, int statusCode = StatusCodes.Status400BadRequest, EndpointMetadataCollection metadata = null)
Infrastructure\JsonResultExecutorTestBase.cs (2)
478private static HttpContext GetHttpContext() 496protected static byte[] GetWrittenBytes(HttpContext context)
Infrastructure\ObjectResultExecutorTest.cs (2)
97var httpContext = GetHttpContext(); 467private static HttpContext GetHttpContext()
LocalRedirectResultTest.cs (5)
70var httpContext = GetHttpContext(appRoot); 94var httpContext = GetHttpContext(appRoot); 116var httpContext = GetHttpContext(appRoot); 128private static ActionContext GetActionContext(HttpContext httpContext) 145private static HttpContext GetHttpContext(
ModelBinding\Binders\BodyModelBinderTests.cs (1)
676HttpContext httpContext = null,
ModelBinding\Binders\FormCollectionModelBinderTest.cs (5)
23var httpContext = GetMockHttpContext(formCollection); 44var httpContext = GetMockHttpContext(null, hasForm: false); 57private static HttpContext GetMockHttpContext(IFormCollection formCollection, bool hasForm = true) 59var httpContext = new Mock<HttpContext>(); 66private static DefaultModelBindingContext GetBindingContext(Type modelType, HttpContext httpContext)
ModelBinding\Binders\FormFileModelBinderTest.cs (21)
21var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 46var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 81var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 121var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 162var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 196var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 228var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 261var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 278var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 296var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 316var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 339var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 366var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 386var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 404var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 421var httpContext = GetMockHttpContext(GetMockFormCollection(formFiles)); 432private static DefaultModelBindingContext GetBindingContextForReadOnlyArray(HttpContext httpContext) 445private static DefaultModelBindingContext GetBindingContext(Type modelType, HttpContext httpContext) 455HttpContext httpContext) 472private static HttpContext GetMockHttpContext(IFormCollection formCollection) 474var httpContext = new Mock<HttpContext>();
ModelBinding\FormFileValueProviderFactoryTest.cs (1)
104var context = new Mock<HttpContext>();
ModelBinding\FormValueProviderFactoryTest.cs (1)
92var context = new Mock<HttpContext>();
ModelBinding\JQueryFormValueProviderFactoryTest.cs (1)
177var context = new Mock<HttpContext>();
ModelBinding\Validation\DefaultObjectValidatorTests.cs (1)
584var httpContext = new Mock<HttpContext>();
MvcCoreLoggerExtensionsTest.cs (2)
410var httpContext = Mock.Of<HttpContext>();
PhysicalFileResultTest.cs (1)
17HttpContext httpContext,
RedirectResultTest.cs (1)
16protected override Task ExecuteAsync(HttpContext httpContext, string contentPath)
RedirectToActionResultTest.cs (2)
26var httpContext = new Mock<HttpContext>(); 58var httpContext = new Mock<HttpContext>();
RedirectToPageResultTest.cs (3)
50var httpContext = new Mock<HttpContext>(); 191var httpContext = new Mock<HttpContext>(); 241var httpContext = new Mock<HttpContext>();
RedirectToRouteResultTest.cs (6)
28var httpContext = new Mock<HttpContext>(); 58var httpContext = new Mock<HttpContext>(); 100var httpContext = GetHttpContext(factory.Object); 122var httpContext = GetHttpContext(); 147var httpContext = GetHttpContext(); 165private static HttpContext GetHttpContext(IUrlHelperFactory factory = null)
RequireHttpsAttributeTests.cs (1)
227private static AuthorizationFilterContext CreateAuthorizationContext(HttpContext ctx)
Routing\ControllerLinkGeneratorExtensionsTest.cs (4)
57var httpContext = CreateHttpContext(new { controller = "Home", }); 115var httpContext = CreateHttpContext(); 176var httpContext = CreateHttpContext(new { controller = "Home", action = "Index", }); 230private HttpContext CreateHttpContext(object ambientValues = null)
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\EndpointRoutingUrlHelperTest.cs (4)
140var httpContext = actionContext.HttpContext; 165var httpContext = CreateHttpContext(services, appRoot: "", host: null, protocol: null); 173var httpContext = CreateHttpContext(serviceProvider, null, null, "http"); 185var httpContext = CreateHttpContext(serviceProvider, appRoot, host, protocol);
Routing\KnownRouteValueConstraintTests.cs (5)
70var httpContext = GetHttpContext(); 100var httpContext = GetHttpContext(); 137var httpContext = GetHttpContext(); 166var httpContext = GetHttpContext(); 269private static HttpContext GetHttpContext() => new DefaultHttpContext();
Routing\MvcRouteHandlerTests.cs (1)
110var httpContext = new Mock<HttpContext>();
Routing\PageLinkGeneratorExtensionsTest.cs (4)
29var httpContext = CreateHttpContext(new { page = "/About", id = 17, }); 86var httpContext = CreateHttpContext(new { page = "/Admin/ManageUsers", handler = "DeleteUser", }); 146var httpContext = CreateHttpContext(new { page = "/Admin/ManageUsers", }); 200private HttpContext CreateHttpContext(object ambientValues = null)
Routing\UrlHelperBaseTest.cs (5)
43var httpContext = CreateHttpContext(services, appBase, host: null, protocol: null); 64var httpContext = CreateHttpContext(services, appBase, host: null, protocol: null); 91var httpContext = CreateHttpContext(services, appBase, host, protocol); 114private static HttpContext CreateHttpContext( 131private static ActionContext CreateActionContext(HttpContext context)
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);
Routing\UrlHelperTestBase.cs (6)
887var httpContext = new Mock<HttpContext>(); 909var httpContext = new Mock<HttpContext>(); 928var httpContext = new Mock<HttpContext>(); 1129var httpContext = CreateHttpContext(services, appRoot, host, protocol); 1135protected virtual ActionContext CreateActionContext(HttpContext httpContext, RouteData routeData = null) 1141protected virtual HttpContext CreateHttpContext(
SignInResultTest.cs (3)
23var httpContext = new Mock<HttpContext>(); 50var httpContext = new Mock<HttpContext>(); 78var httpContext = new Mock<HttpContext>();
SignOutResultTest.cs (6)
21var httpContext = new Mock<HttpContext>(); 47var httpContext = new Mock<HttpContext>(); 74var httpContext = new Mock<HttpContext>(); 104var httpContext = new Mock<HttpContext>(); 124var httpContext = new Mock<HttpContext>(); 145var httpContext = new Mock<HttpContext>();
src\Shared\ResultsTests\FileContentResultTestBase.cs (12)
20HttpContext httpContext, 32var httpContext = GetHttpContext(); 61var httpContext = GetHttpContext(); 100var httpContext = GetHttpContext(); 139var httpContext = GetHttpContext(); 173var httpContext = GetHttpContext(); 210var httpContext = GetHttpContext(); 241var httpContext = GetHttpContext(); 273var httpContext = GetHttpContext(); 307var httpContext = GetHttpContext(); 340var httpContext = GetHttpContext(); 361private static HttpContext GetHttpContext()
src\Shared\ResultsTests\FileStreamResultTestBase.cs (14)
17HttpContext httpContext, 39var httpContext = GetHttpContext(); 81var httpContext = GetHttpContext(); 122var httpContext = GetHttpContext(); 159var httpContext = GetHttpContext(); 198var httpContext = GetHttpContext(); 231var httpContext = GetHttpContext(); 265var httpContext = GetHttpContext(); 301var httpContext = GetHttpContext(); 342var httpContext = GetHttpContext(); 382var httpContext = GetHttpContext(); 407var httpContext = GetHttpContext(); 427var httpContext = GetHttpContext(); 449private static HttpContext GetHttpContext()
src\Shared\ResultsTests\PhysicalFileResultTestBase.cs (17)
23HttpContext httpContext, 40var httpContext = GetHttpContext(); 72var httpContext = GetHttpContext(); 104var httpContext = GetHttpContext(); 131var httpContext = GetHttpContext(); 160var httpContext = GetHttpContext(); 187var httpContext = GetHttpContext(); 216var httpContext = GetHttpContext(); 243var httpContext = GetHttpContext(); 276var httpContext = GetHttpContext(); 296var httpContext = GetHttpContext(); 329var httpContext = GetHttpContext(); 350var httpContext = GetHttpContext(); 380var httpContext = GetHttpContext(); 402var httpContext = GetHttpContext(); 415var httpContext = GetHttpContext(); 466private static HttpContext GetHttpContext()
src\Shared\ResultsTests\RedirectResultTestBase.cs (4)
16protected abstract Task ExecuteAsync(HttpContext httpContext, string contentPath); 27var httpContext = GetHttpContext(appRoot); 50var httpContext = GetHttpContext(appRoot); 69private static HttpContext GetHttpContext(
src\Shared\ResultsTests\VirtualFileResultTestBase.cs (17)
26HttpContext httpContext, 51var httpContext = GetHttpContext(GetFileProvider(path)); 88var httpContext = GetHttpContext(GetFileProvider(path)); 125var httpContext = GetHttpContext(GetFileProvider(path)); 158var httpContext = GetHttpContext(GetFileProvider(path)); 194var httpContext = GetHttpContext(GetFileProvider(path)); 227var httpContext = GetHttpContext(GetFileProvider(path)); 264var httpContext = GetHttpContext(GetFileProvider(path)); 295var httpContext = GetHttpContext(GetFileProvider(path)); 327var httpContext = GetHttpContext(GetFileProvider(path)); 364var httpContext = GetHttpContext(GetFileProvider("FilePathResultTestFile_ASCII.txt")); 382var httpContext = GetHttpContext(GetFileProvider(path)); 404var httpContext = GetHttpContext(webRootFileProvider); 427var httpContext = GetHttpContext(webRootFileProvider); 452var httpContext = GetHttpContext(nonDiskFileProvider.Object); 475var httpContext = GetHttpContext(fileProvider.Object); 498private static HttpContext GetHttpContext(IFileProvider webRootFileProvider)
VirtualFileResultTest.cs (1)
81protected override Task ExecuteAsync(HttpContext httpContext, string path, string contentType, DateTimeOffset? lastModified = null, EntityTagHeaderValue entityTag = null, bool enableRangeProcessing = false)
Microsoft.AspNetCore.Mvc.Cors (1)
CorsAuthorizationFilter.cs (1)
74var httpContext = context.HttpContext;
Microsoft.AspNetCore.Mvc.Cors.Test (3)
CorsAuthorizationFilterTest.cs (3)
120.Setup(o => o.GetPolicyAsync(It.IsAny<HttpContext>(), It.IsAny<string>())) 171.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>())) 188.Setup(o => o.EvaluatePolicy(It.IsAny<HttpContext>(), It.IsAny<CorsPolicy>()))
Microsoft.AspNetCore.Mvc.DataAnnotations.Test (1)
DataAnnotationsModelValidatorTest.cs (1)
404var httpContext = new Mock<HttpContext>();
Microsoft.AspNetCore.Mvc.Formatters.Xml (2)
XmlDataContractSerializerOutputFormatter.cs (1)
221var httpContext = context.HttpContext;
XmlSerializerOutputFormatter.cs (1)
200var httpContext = context.HttpContext;
Microsoft.AspNetCore.Mvc.Formatters.Xml.Test (16)
XmlDataContractSerializerInputFormatterTest.cs (7)
74var httpContext = GetHttpContext(contentBytes, contentType: requestContentType); 511var httpContext = GetHttpContext(inputBytes, contentType: "application/xml; charset=utf-16"); 575var httpContext = GetHttpContext(contentBytes, contentType: "application/xml; charset=utf-16"); 718var httpContext = GetHttpContext(contentBytes); 722private InputFormatterContext GetInputFormatterContext(HttpContext httpContext, Type modelType) 734private static HttpContext GetHttpContext( 745var httpContext = new Mock<HttpContext>();
XmlDataContractSerializerOutputFormatterTest.cs (1)
800private static HttpContext GetHttpContext(string contentType)
XmlSerializerInputFormatterTest.cs (7)
252var httpContext = GetHttpContext(contentBytes, contentType: requestContentType); 532var httpContext = GetHttpContext(inputBytes, contentType: "application/xml; charset=utf-16"); 597var httpContext = GetHttpContext(contentBytes, contentType: "application/xml; charset=utf-16"); 654var httpContext = GetHttpContext(contentBytes); 658private InputFormatterContext GetInputFormatterContext(HttpContext httpContext, Type modelType) 670private static HttpContext GetHttpContext( 681var httpContext = new Mock<HttpContext>();
XmlSerializerOutputFormatterTest.cs (1)
582private static HttpContext GetHttpContext(string contentType)
Microsoft.AspNetCore.Mvc.FunctionalTests (1)
Infrastructure\CultureReplacerMiddleware.cs (1)
30public async Task Invoke(HttpContext context)
Microsoft.AspNetCore.Mvc.IntegrationTests (15)
AuthorizeFilterIntegrationTest.cs (1)
155private HttpContext GetHttpContext()
BodyValidationIntegrationTests.cs (1)
720var httpContext = testContext.HttpContext;
HeaderModelBinderIntegrationTest.cs (1)
280var httpContext = testContext.HttpContext;
ModelBindingTestHelper.cs (4)
28var httpContext = GetHttpContext(metadataProvider, updateRequest, updateOptions, mvcOptions); 146private static HttpContext GetHttpContext( 222private readonly HttpContext _context; 224public NonZeroContentLengthRequestBodyDetectionFeature(HttpContext context)
ValidationIntegrationTests.cs (4)
1796var httpContext = testContext.HttpContext; 1840var httpContext = testContext.HttpContext; 1885var httpContext = testContext.HttpContext; 1932var httpContext = testContext.HttpContext;
ValidationWithRecordIntegrationTests.cs (4)
1599var httpContext = testContext.HttpContext; 1643var httpContext = testContext.HttpContext; 1688var httpContext = testContext.HttpContext; 1735var httpContext = testContext.HttpContext;
Microsoft.AspNetCore.Mvc.NewtonsoftJson (1)
NewtonsoftJsonInputFormatter.cs (1)
101var httpContext = context.HttpContext;
Microsoft.AspNetCore.Mvc.NewtonsoftJson.Test (47)
JsonResultTest.cs (2)
39private static HttpContext GetHttpContext() 63private static byte[] GetWrittenBytes(HttpContext context)
NewtonsoftJsonInputFormatterTest.cs (9)
161var httpContext = GetHttpContext(contentBytes, "application/json;charset=utf-8"); 238var httpContext = GetHttpContext(contentBytes); 263var httpContext = GetHttpContext(contentBytes); 293var httpContext = GetHttpContext(contentBytes); 326var httpContext = GetHttpContext(contentBytes); 358var httpContext = GetHttpContext(contentBytes); 389var httpContext = GetHttpContext(contentBytes); 420var httpContext = GetHttpContext(contentBytes); 447var httpContext = new Mock<HttpContext>();
NewtonsoftJsonPatchInputFormatterTest.cs (8)
111var httpContext = CreateHttpContext(contentBytes); 135var httpContext = CreateHttpContext(contentBytes); 164var httpContext = CreateHttpContext(contentBytes, contentType: requestContentType); 185var httpContext = CreateHttpContext(contentBytes, contentType: "application/json-patch+json"); 210var httpContext = CreateHttpContext(contentBytes, contentType: "application/json-patch+json"); 241private InputFormatterContext CreateInputFormatterContext(Type modelType, HttpContext httpContext) 254private static HttpContext CreateHttpContext( 265var httpContext = new Mock<HttpContext>();
src\Mvc\Mvc.Core\test\Formatters\JsonInputFormatterTestBase.cs (26)
39var httpContext = GetHttpContext(contentBytes, contentType: requestContentType); 71var httpContext = GetHttpContext(contentBytes); 92var httpContext = GetHttpContext(contentBytes); 113var httpContext = GetHttpContext(contentBytes, "application/json;charset=utf-16"); 137var httpContext = GetHttpContext(contentBytes); 165var httpContext = GetHttpContext(contentBytes); 192var httpContext = GetHttpContext(contentBytes); 219var httpContext = GetHttpContext(contentBytes); 240var httpContext = GetHttpContext(contentBytes); 262var httpContext = GetHttpContext(contentBytes); 294var httpContext = GetHttpContext(contentBytes); 315var httpContext = GetHttpContext(contentBytes); 342var httpContext = GetHttpContext(contentBytes); 368var httpContext = GetHttpContext(contentBytes); 394var httpContext = GetHttpContext(contentBytes); 421var httpContext = GetHttpContext(contentBytes); 451var httpContext = GetHttpContext(contentBytes); 475var httpContext = GetHttpContext(contentBytes); 501var httpContext = GetHttpContext(contentBytes); 525var httpContext = GetHttpContext(contentBytes); 545var httpContext = GetHttpContext(contentBytes); 568var httpContext = GetHttpContext(contentBytes); 592var httpContext = GetHttpContext(contentBytes); 629protected static HttpContext GetHttpContext( 636protected static HttpContext GetHttpContext( 650HttpContext httpContext,
src\Mvc\Mvc.Core\test\Infrastructure\JsonResultExecutorTestBase.cs (2)
478private static HttpContext GetHttpContext() 496protected static byte[] GetWrittenBytes(HttpContext context)
Microsoft.AspNetCore.Mvc.Razor (7)
Diagnostics\MvcDiagnostics.cs (4)
30public BeforeViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) 56public HttpContext HttpContext { get; } 91public AfterViewPageEventData(IRazorPage page, ViewContext viewContext, ActionDescriptor actionDescriptor, HttpContext httpContext) 117public HttpContext HttpContext { get; }
LanguageViewLocationExpander.cs (1)
10/// that is getting added as extension prefix comes from <see cref="Microsoft.AspNetCore.Http.HttpContext"/>.
RazorPage.cs (2)
21/// An <see cref="HttpContext"/> representing the current request execution. 23public HttpContext Context => ViewContext?.HttpContext!;
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation (2)
PageLoaderMatcherPolicy.cs (2)
19/// until we need to load a page in the body of <see cref="ApplyAsync(HttpContext, CandidateSet)"/>. 55public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
Microsoft.AspNetCore.Mvc.Razor.Test (8)
DefaultTagHelperFactoryTest.cs (6)
34var httpContext = MakeHttpContext(services.BuildServiceProvider()); 56var httpContext = MakeHttpContext(services.BuildServiceProvider()); 83var httpContext = MakeHttpContext(services.BuildServiceProvider()); 111var httpContext = MakeHttpContext(services.BuildServiceProvider()); 136private static HttpContext MakeHttpContext(IServiceProvider services = null) 153private static ViewContext MakeViewContext(HttpContext httpContext)
Infrastructure\DefaultTagHelperActivatorTest.cs (1)
39private static ViewContext MakeViewContext(HttpContext httpContext)
RazorPageCreateTagHelperTest.cs (1)
89var httpContext = new Mock<HttpContext>();
Microsoft.AspNetCore.Mvc.RazorPages (7)
Infrastructure\DynamicPageEndpointMatcherPolicy.cs (1)
61public async Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
PageBase.cs (2)
40/// Gets the <see cref="Http.HttpContext"/>. 42public HttpContext HttpContext => PageContext?.HttpContext!;
PageContext.cs (2)
46/// <param name="httpContext">The <see cref="HttpContext"/> for the current request.</param> 50HttpContext httpContext,
PageModel.cs (2)
59/// Gets the <see cref="Http.HttpContext"/>. 61public HttpContext HttpContext => PageContext.HttpContext;
Microsoft.AspNetCore.Mvc.RazorPages.Test (14)
Filters\PageSaveTempDataPropertyFilterTest.cs (1)
194.Setup(f => f.GetTempData(It.IsAny<HttpContext>()))
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)
Infrastructure\PageActionInvokerProviderTest.cs (2)
501.Setup(t => t.GetTempData(It.IsAny<HttpContext>())) 502.Returns((HttpContext context) => new TempDataDictionary(context, Mock.Of<ITempDataProvider>()));
Infrastructure\PageActionInvokerTest.cs (1)
1518tempDataFactory = Mock.Of<ITempDataDictionaryFactory>(m => m.GetTempData(It.IsAny<HttpContext>()) == Mock.Of<ITempDataDictionary>());
PageModelTest.cs (2)
1443var mockHttpContext = new Mock<HttpContext>(); 1470var mockHttpContext = new Mock<HttpContext>();
PageTest.cs (2)
1433var mockHttpContext = new Mock<HttpContext>(); 1460var mockHttpContext = new Mock<HttpContext>();
Microsoft.AspNetCore.Mvc.TagHelpers (2)
Cache\CacheTagKey.cs (1)
81var httpContext = tagHelper.ViewContext.HttpContext;
CacheTagHelperBase.cs (1)
92/// <see cref="Http.HttpContext.User"/>.
Microsoft.AspNetCore.Mvc.Test (10)
Routing\ActionConstraintMatcherPolicyTest.cs (10)
63var httpContext = CreateHttpContext("POST"); 98var httpContext = CreateHttpContext("POST"); 134var httpContext = CreateHttpContext("POST"); 169var httpContext = CreateHttpContext("POST"); 207var httpContext = CreateHttpContext("POST"); 242var httpContext = CreateHttpContext("POST"); 283var httpContext = CreateHttpContext("POST"); 324var httpContext = CreateHttpContext("POST"); 361var httpContext = CreateHttpContext("POST"); 464private static HttpContext CreateHttpContext(string httpMethod)
Microsoft.AspNetCore.Mvc.ViewFeatures (26)
AntiforgeryExtensions.cs (2)
22/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 31public static IHtmlContent GetHtml(this IAntiforgery antiforgery, HttpContext httpContext)
CookieTempDataProvider.cs (5)
54/// <param name="context">The <see cref="HttpContext"/>.</param> 56public IDictionary<string, object> LoadTempData(HttpContext context) 100/// <param name="context">The <see cref="HttpContext"/>.</param> 102public void SaveTempData(HttpContext context, IDictionary<string, object> values) 123private void SetCookiePath(HttpContext httpContext, CookieOptions cookieOptions)
Filters\SaveTempDataFilter.cs (4)
14private static readonly Func<object, Task> OnStartingCallback = (state) => OnStarting((HttpContext)state); 50private static Task OnStarting(HttpContext httpContext) 117private static SaveTempDataContext GetTempDataContext(HttpContext httpContext) 131HttpContext httpContext)
ITempDataDictionaryFactory.cs (2)
18/// <param name="context">The <see cref="HttpContext"/>.</param> 23ITempDataDictionary GetTempData(HttpContext context);
ITempDataProvider.cs (4)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 18IDictionary<string, object> LoadTempData(HttpContext context); 23/// <param name="context">The <see cref="HttpContext"/>.</param> 25void SaveTempData(HttpContext context, IDictionary<string, object> values);
Rendering\HtmlHelperComponentExtensions.cs (1)
62var httpContext = htmlHelper.ViewContext.HttpContext;
SessionStateTempDataProvider.cs (2)
28public virtual IDictionary<string, object> LoadTempData(HttpContext context) 47public virtual void SaveTempData(HttpContext context, IDictionary<string, object> values)
TempDataDictionary.cs (3)
25private readonly HttpContext _context; 32/// <param name="context">The <see cref="HttpContext"/>.</param> 34public TempDataDictionary(HttpContext context, ITempDataProvider provider)
TempDataDictionaryFactory.cs (1)
29public ITempDataDictionary GetTempData(HttpContext context)
ViewComponent.cs (2)
32/// Gets the <see cref="Http.HttpContext"/>. 34public HttpContext HttpContext => ViewContext?.HttpContext!;
Microsoft.AspNetCore.Mvc.ViewFeatures.Test (50)
AntiforgeryExtensionsTest.cs (1)
22.Setup(a => a.GetAndStoreTokens(It.IsAny<HttpContext>()))
ControllerUnitTestabilityTests.cs (1)
158var mockHttpContext = new Mock<HttpContext>();
CookieTempDataProviderTest.cs (3)
302var context = GetHttpContext(); 313private static HttpContext GetHttpContext() 320private void UpdateRequestWithCookies(HttpContext httpContext)
Filters\AutoValidateAntiforgeryTokenAuthorizationFilterTest.cs (5)
25.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>())) 53.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>())) 68antiforgery.Verify(a => a.ValidateRequestAsync(It.IsAny<HttpContext>()), Times.Never()); 77.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>())) 96antiforgery.Verify(a => a.ValidateRequestAsync(It.IsAny<HttpContext>()), Times.Never());
Filters\ControllerSaveTempDataPropertyFilterTest.cs (1)
200HttpContext httpContext,
Filters\SaveTempDataFilterTest.cs (25)
33var httpContext = GetHttpContext(responseFeature); 36.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 61.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 64var httpContext = GetHttpContext(responseFeature.Object); 72tempDataFactory.Verify(tdf => tdf.GetTempData(It.IsAny<HttpContext>()), Times.Never()); 80var httpContext = GetHttpContext(responseFeature); 84.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 101var httpContext = GetHttpContext(responseFeature); 105.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 115tempDataFactory.Verify(tdf => tdf.GetTempData(It.IsAny<HttpContext>()), Times.Never()); 123var httpContext = GetHttpContext(responseFeature); 127.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 137tempDataFactory.Verify(tdf => tdf.GetTempData(It.IsAny<HttpContext>()), Times.Never()); 148var httpContext = GetHttpContext(responseFeature); 168var httpContext = GetHttpContext(responseFeature); 189var actionContext = GetHttpContext(responseFeature); 207.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 210var httpContext = GetHttpContext(new TestResponseFeature(hasStarted: true)); 217tempDataFactory.Verify(tdf => tdf.GetTempData(It.IsAny<HttpContext>()), Times.Never()); 278.Setup(f => f.GetTempData(It.IsAny<HttpContext>())) 295private ResourceExecutingContext GetResourceExecutingContext(HttpContext httpContext) 310private ResultExecutedContext GetResultExecutedContext(HttpContext httpContext = null, IActionResult actionResult = null) 340private ResultExecutingContext GetResultExecutingContext(HttpContext httpContext = null, IActionResult actionResult = null) 357private HttpContext GetHttpContext(IHttpResponseFeature responseFeature = null) 368private ActionContext GetActionContext(HttpContext httpContext = null)
Filters\ValidateAntiforgeryTokenAuthorizationFilterTest.cs (4)
29.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>())) 53.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>())) 72antiforgery.Verify(a => a.ValidateRequestAsync(It.IsAny<HttpContext>()), Times.Never()); 81.Setup(a => a.ValidateRequestAsync(It.IsAny<HttpContext>()))
PartialViewResultTest.cs (1)
231private HttpContext GetHttpContext()
SessionStateTempDataProviderTest.cs (2)
63var context = GetHttpContext(); 78private HttpContext GetHttpContext(bool sessionEnabled = true)
TempDataDictionaryTest.cs (4)
182public IDictionary<string, object> LoadTempData(HttpContext context) 187public void SaveTempData(HttpContext context, IDictionary<string, object> values) 201public IDictionary<string, object> LoadTempData(HttpContext context) 206public void SaveTempData(HttpContext context, IDictionary<string, object> values)
ViewComponentResultTest.cs (2)
651HttpContext context, 686private HttpContext CreateHttpContext(object diagnosticListener, params ViewComponentDescriptor[] descriptors)
ViewResultTest.cs (1)
243private HttpContext GetHttpContext()
Microsoft.AspNetCore.OpenApi (6)
Extensions\OpenApiEndpointRouteBuilderExtensions.cs (1)
31return endpoints.MapGet(pattern, async (HttpContext context, string documentName = OpenApiConstants.DefaultDocumentName) =>
Services\OpenApiGenerator.cs (1)
424parameter.ParameterType == typeof(HttpContext) ||
src\Shared\ParameterBindingMethodCache.cs (4)
39internal static readonly ParameterExpression HttpContextExpr = Expression.Parameter(typeof(HttpContext), "httpContext"); 226methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext), typeof(ParameterInfo) }, ValidateReturnType); 231methodInfo = GetStaticMethodFromHierarchy(nonNullableParameterType, "BindAsync", new[] { typeof(HttpContext) }, ValidateReturnType); 424private static ValueTask<TValue?> BindAsync<TValue>(HttpContext httpContext, ParameterInfo parameter)
Microsoft.AspNetCore.OpenApi.Tests (8)
Services\OpenApiGeneratorTests.cs (8)
414Assert.Empty(GetOpenApiOperation((HttpContext context) => { }).Parameters); 1062public static ValueTask<BindAsyncRecord> BindAsync(HttpContext context, ParameterInfo parameter) => 1068private record ArgumentListRecord([FromRoute] int Foo, int Bar, InferredJsonClass FromBody, HttpContext context); 1070private record struct ArgumentListRecordStruct([FromRoute] int Foo, int Bar, InferredJsonClass FromBody, HttpContext context); 1072private record ArgumentListRecordWithoutAttributes(int Foo, int Bar, InferredJsonClass FromBody, HttpContext context); 1080public HttpContext Context { get; set; } 1089public HttpContext Context { get; set; } 1103public HttpContext Context { get; set; }
Microsoft.AspNetCore.OutputCaching (18)
OutputCacheContext.cs (1)
43public required HttpContext HttpContext { get; init; }
OutputCacheMiddleware.cs (5)
79/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 81public Task Invoke(HttpContext httpContext) 92private async Task InvokeAwaited(HttpContext httpContext, IReadOnlyList<IOutputCachePolicy> policies) 215internal bool TryGetRequestPolicies(HttpContext httpContext, out IReadOnlyList<IOutputCachePolicy> policies) 504internal static void RemoveOutputCacheFeature(HttpContext context) =>
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)
Policies\SetCacheKeyPrefixPolicy.cs (2)
13private readonly Func<HttpContext, CacheVaryByRules, CancellationToken, ValueTask> _varyByAsync; 18public SetCacheKeyPrefixPolicy(Func<HttpContext, CancellationToken, ValueTask<string>> varyBy)
Policies\VaryByValuePolicy.cs (2)
13private readonly Func<HttpContext, CacheVaryByRules, CancellationToken, ValueTask> _varyByAsync; 18public VaryByValuePolicy(Func<HttpContext, CancellationToken, ValueTask<KeyValuePair<string, string>>> varyBy)
Microsoft.AspNetCore.OutputCaching.Tests (8)
TestUtils.cs (8)
33private static bool TestRequestDelegate(HttpContext context, string guid) 46internal static async Task TestRequestDelegateWriteAsync(HttpContext context) 55internal static async Task TestRequestDelegateSendFileAsync(HttpContext context) 66internal static Task TestRequestDelegateWrite(HttpContext context) 81internal static async Task TestRequestDelegatePipeWriteAsync(HttpContext context) 104Action<HttpContext>? contextAction = null) 222internal static OutputCacheContext CreateTestContext(HttpContext? httpContext = null, IOutputCacheStore? cache = null, OutputCacheOptions? options = null, ITestSink? testSink = null) 242internal static OutputCacheContext CreateUninitializedContext(HttpContext? httpContext = null, IOutputCacheStore? cache = null, OutputCacheOptions? options = null, ITestSink? testSink = null)
Microsoft.AspNetCore.Owin (12)
OwinEnvironment.cs (6)
27/// A loosely-typed OWIN environment wrapper over an <see cref="HttpContext"/>. 31private readonly HttpContext _context; 38public OwinEnvironment(HttpContext context) 132_context.Items[typeof(HttpContext).FullName] = _context; // Store for lookup when we transition back out of OWIN 388internal bool TryGet(HttpContext context, out object value) 404internal void Set(HttpContext context, object value)
OwinExtensions.cs (6)
40return next1((HttpContext)env[typeof(HttpContext).FullName]); 51env[typeof(HttpContext).FullName] = httpContext; 135HttpContext context; 137if (env.TryGetValue(typeof(HttpContext).FullName, out obj)) 139context = (HttpContext)obj;
Microsoft.AspNetCore.Owin.Tests (6)
OwinEnvironmentTests.cs (5)
21HttpContext context = CreateContext(); 60HttpContext context = CreateContext(); 102HttpContext context = CreateContext(); 117HttpContext context = CreateContext(); 162private HttpContext CreateContext()
OwinExtensionTests.cs (1)
147kvp => string.Equals(typeof(HttpContext).FullName, kvp.Key, StringComparison.Ordinal))
Microsoft.AspNetCore.RateLimiting (21)
DefaultRateLimiterPolicy.cs (3)
11private readonly Func<HttpContext, RateLimitPartition<DefaultKeyType>> _partitioner; 14public DefaultRateLimiterPolicy(Func<HttpContext, RateLimitPartition<DefaultKeyType>> partitioner, Func<OnRejectedContext, CancellationToken, ValueTask>? onRejected) 22public RateLimitPartition<DefaultKeyType> GetPartition(HttpContext httpContext)
IRateLimiterPolicy.cs (3)
20/// Gets the <see cref="RateLimitPartition{TPartitionKey}"/> that applies to the given <see cref="HttpContext"/>. 22/// <param name="httpContext">The <see cref="HttpContext"/> to get the partition for.</param> 23RateLimitPartition<TPartitionKey> GetPartition(HttpContext httpContext);
OnRejectedContext.cs (1)
17public required HttpContext HttpContext { get; init; }
RateLimiterOptions.cs (4)
26public PartitionedRateLimiter<HttpContext>? GlobalLimiter { get; set; } 48public RateLimiterOptions AddPolicy<TPartitionKey>(string policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner) 109internal static Func<HttpContext, RateLimitPartition<DefaultKeyType>> ConvertPartitioner<TPartitionKey>(string? policyName, Func<HttpContext, RateLimitPartition<TPartitionKey>> partitioner)
RateLimitingMiddleware.cs (10)
21private readonly PartitionedRateLimiter<HttpContext>? _globalLimiter; 22private readonly PartitionedRateLimiter<HttpContext> _endpointLimiter; 63/// <param name="context">The <see cref="HttpContext"/>.</param> 65public Task Invoke(HttpContext context) 83private async Task InvokeInternal(HttpContext context, EnableRateLimitingAttribute? enableRateLimitingAttribute) 151private async ValueTask<LeaseContext> TryAcquireAsync(HttpContext context, MetricsContext metricsContext) 179private LeaseContext CombinedAcquire(HttpContext context) 210private async ValueTask<LeaseContext> CombinedWaitAsync(HttpContext context, CancellationToken cancellationToken) 252private PartitionedRateLimiter<HttpContext> CreateEndpointLimiter() 255return PartitionedRateLimiter.Create<HttpContext, DefaultKeyType>(context =>
Microsoft.AspNetCore.RateLimiting.Tests (15)
RateLimitingApplicationBuilderExtensionsTests.cs (2)
44options.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 50options.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false));
RateLimitingMetricsTests.cs (3)
31options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 71options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(true)); 130options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(true));
RateLimitingMiddlewareTests.cs (9)
22options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(); 65options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(true)); 90options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 115options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 144options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 293options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 325options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(true)); 357options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false)); 524options.Value.GlobalLimiter = new TestPartitionedRateLimiter<HttpContext>(new TestRateLimiter(false));
TestRateLimiterPolicy.cs (1)
28public RateLimitPartition<string> GetPartition(HttpContext httpContext)
Microsoft.AspNetCore.RequestDecompression (6)
DefaultRequestDecompressionProvider.cs (1)
30public Stream? GetDecompressionStream(HttpContext context)
IRequestDecompressionProvider.cs (2)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 18Stream? GetDecompressionStream(HttpContext context);
RequestDecompressionMiddleware.cs (3)
43/// <param name="context">The <see cref="HttpContext"/>.</param> 45public Task Invoke(HttpContext context) 56private async Task InvokeCore(HttpContext context, Stream decompressionStream)
Microsoft.AspNetCore.RequestDecompression.Tests (3)
RequestDecompressionMiddlewareTests.cs (3)
616static Task requestDelegate(HttpContext context) => Task.FromResult(context); 631static Task requestDelegate(HttpContext context) => Task.FromResult(context); 653public Stream? GetDecompressionStream(HttpContext context)
Microsoft.AspNetCore.ResponseCaching (6)
ResponseCachingContext.cs (2)
23internal ResponseCachingContext(HttpContext httpContext, ILogger logger) 29public HttpContext HttpContext { get; }
ResponseCachingMiddleware.cs (4)
83/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 85public async Task Invoke(HttpContext httpContext) 392internal static void AddResponseCachingFeature(HttpContext context) 416internal static void RemoveResponseCachingFeature(HttpContext context) =>
Microsoft.AspNetCore.ResponseCaching.Tests (5)
TestUtils.cs (5)
32private static bool TestRequestDelegate(HttpContext context, string guid) 71internal static async Task TestRequestDelegateWriteAsync(HttpContext context) 80internal static async Task TestRequestDelegateSendFileAsync(HttpContext context) 91internal static Task TestRequestDelegateWrite(HttpContext context) 119Action<HttpContext> contextAction = null)
Microsoft.AspNetCore.ResponseCompression (14)
IResponseCompressionProvider.cs (6)
16/// <param name="context">The <see cref="HttpContext"/>.</param> 18ICompressionProvider? GetCompressionProvider(HttpContext context); 23/// <param name="context">The <see cref="HttpContext"/>.</param> 25bool ShouldCompressResponse(HttpContext context); 30/// <param name="context">The <see cref="HttpContext"/>.</param> 32bool CheckRequestAcceptsCompression(HttpContext context);
ResponseCompressionBody.cs (2)
17private readonly HttpContext _context; 30internal ResponseCompressionBody(HttpContext context, IResponseCompressionProvider provider,
ResponseCompressionMiddleware.cs (3)
35/// <param name="context">The <see cref="HttpContext"/>.</param> 37public Task Invoke(HttpContext context) 46private async Task InvokeCore(HttpContext context)
ResponseCompressionProvider.cs (3)
75public virtual ICompressionProvider? GetCompressionProvider(HttpContext context) 163public virtual bool ShouldCompressResponse(HttpContext context) 219public bool CheckRequestAcceptsCompression(HttpContext context)
Microsoft.AspNetCore.ResponseCompression.Tests (3)
ResponseCompressionBodyTest.cs (3)
102public ICompressionProvider GetCompressionProvider(HttpContext context) 107public bool ShouldCompressResponse(HttpContext context) 112public bool CheckRequestAcceptsCompression(HttpContext context)
Microsoft.AspNetCore.Rewrite (4)
RewriteContext.cs (1)
20public HttpContext HttpContext { get; set; } = default!;
RewriteMiddleware.cs (3)
50/// <param name="context">The <see cref="HttpContext"/> for the current request.</param> 52public Task Invoke(HttpContext context) 92static void RunRules(RewriteContext rewriteContext, RewriteOptions options, HttpContext httpContext, ILogger logger)
Microsoft.AspNetCore.Rewrite.Tests (4)
IISUrlRewrite\ServerVariableTests.cs (4)
62var httpContext = CreateTestHttpContext(); 110var httpContext = CreateTestHttpContext(); 135private static HttpContext CreateTestHttpContext() 154private RewriteContext CreateTestRewriteContext(HttpContext context = null)
Microsoft.AspNetCore.Routing (104)
Builder\EndpointRoutingApplicationBuilderExtensions.cs (4)
33/// made, and an <see cref="Endpoint"/> is associated with the <see cref="HttpContext"/>. The <see cref="EndpointMiddleware"/> 36/// <see cref="Endpoint"/> associated with the <see cref="HttpContext"/>. 82/// made, and an <see cref="Endpoint"/> is associated with the <see cref="HttpContext"/>. The <see cref="EndpointMiddleware"/> 85/// <see cref="Endpoint"/> associated with the <see cref="HttpContext"/>.
Constraints\BoolRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\CompositeRouteConstraint.cs (1)
40HttpContext? httpContext,
Constraints\DateTimeRouteConstraint.cs (1)
32HttpContext? httpContext,
Constraints\DecimalRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\DoubleRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\FileNameRouteConstraint.cs (1)
97HttpContext? httpContext,
Constraints\FloatRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\GuidRouteConstraint.cs (1)
28HttpContext? httpContext,
Constraints\HttpMethodRouteConstraint.cs (1)
34HttpContext? httpContext,
Constraints\IntRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\LengthRouteConstraint.cs (1)
82HttpContext? httpContext,
Constraints\LongRouteConstraint.cs (1)
26HttpContext? httpContext,
Constraints\MaxLengthRouteConstraint.cs (1)
46HttpContext? httpContext,
Constraints\MaxRouteConstraint.cs (1)
40HttpContext? httpContext,
Constraints\MinLengthRouteConstraint.cs (1)
46HttpContext? httpContext,
Constraints\MinRouteConstraint.cs (1)
40HttpContext? httpContext,
Constraints\NonFileNameRouteConstraint.cs (1)
93HttpContext? httpContext,
Constraints\NullRouteConstraint.cs (1)
21public bool Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
Constraints\OptionalRouteConstraint.cs (1)
40HttpContext? httpContext,
Constraints\RangeRouteConstraint.cs (1)
54HttpContext? httpContext,
Constraints\RegexErrorStubRouteConstraint.cs (1)
24bool IRouteConstraint.Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
Constraints\RegexRouteConstraint.cs (1)
81HttpContext? httpContext,
Constraints\RequiredRouteConstraint.cs (1)
20HttpContext? httpContext,
Constraints\StringRouteConstraint.cs (1)
29public bool Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
DefaultLinkGenerator.cs (5)
70HttpContext httpContext, 120HttpContext httpContext, 200HttpContext? httpContext, 281HttpContext? httpContext, 317public static RouteValueDictionary? GetAmbientValues(HttpContext? httpContext)
EndpointMiddleware.cs (1)
33public Task Invoke(HttpContext httpContext)
EndpointRoutingMiddleware.cs (7)
59public Task Invoke(HttpContext httpContext) 86static async Task AwaitMatcher(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task<Matcher> matcherTask) 93static async Task AwaitMatch(EndpointRoutingMiddleware middleware, HttpContext httpContext, Task matchTask) 101private Task SetRoutingAndContinue(HttpContext httpContext) 151static void Write(DiagnosticListener diagnosticListener, HttpContext httpContext) 158private Task ExecuteShortCircuit(ShortCircuitMetadata shortCircuitMetadata, Endpoint endpoint, HttpContext httpContext) 302private void SetMaxRequestBodySize(HttpContext context)
LinkGeneratorEndpointNameAddressExtensions.cs (8)
19/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 34HttpContext httpContext, 59/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 74HttpContext httpContext, 155/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 185HttpContext httpContext, 214/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 244HttpContext httpContext,
LinkGeneratorRouteValuesAddressExtensions.cs (9)
19/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 34HttpContext httpContext, 59/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 74HttpContext httpContext, 155/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 185HttpContext httpContext, 214/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 244HttpContext httpContext, 355private static RouteValuesAddress CreateAddress(HttpContext? httpContext, string? routeName, RouteValueDictionary? values)
Matching\AcceptsMatcherPolicy.cs (2)
47public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) 356public override int GetDestination(HttpContext httpContext)
Matching\ContentEncodingNegotiationMatcherPolicy.cs (1)
17private protected override StringValues GetNegotiationHeader(HttpContext httpContext) => httpContext.Request.Headers[HeaderName];
Matching\DataSourceDependentMatcher.cs (1)
33public override Task MatchAsync(HttpContext httpContext)
Matching\DefaultEndpointSelector.cs (3)
12HttpContext httpContext, 22internal static void Select(HttpContext httpContext, Span<CandidateState> candidateState) 57HttpContext httpContext,
Matching\DfaMatcher.cs (4)
32public sealed override Task MatchAsync(HttpContext httpContext) 210HttpContext httpContext, 300HttpContext httpContext, 317HttpContext httpContext,
Matching\EndpointSelector.cs (3)
18/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 23/// <see cref="EndpointHttpContextExtensions.SetEndpoint(HttpContext, Endpoint)"/> 26public abstract Task SelectAsync(HttpContext httpContext, CandidateSet candidates);
Matching\HostMatcherPolicy.cs (3)
71public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) 333private static (string host, int? port) GetHostAndPort(HttpContext httpContext) 376public override int GetDestination(HttpContext httpContext)
Matching\HttpMethodDictionaryPolicyJumpTable.cs (1)
21public override int GetDestination(HttpContext httpContext)
Matching\HttpMethodMatcherPolicy.cs (2)
78public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) 419internal static bool IsCorsPreflightRequest(HttpContext httpContext, string httpMethod, out StringValues accessControlRequestMethod)
Matching\HttpMethodSingleEntryPolicyJumpTable.cs (1)
34public override int GetDestination(HttpContext httpContext)
Matching\IEndpointSelectorPolicy.cs (3)
30/// The <see cref="HttpContext"/> associated with the current request. 41/// calling <see cref="EndpointHttpContextExtensions.SetEndpoint(HttpContext, Endpoint)"/> 46Task ApplyAsync(HttpContext httpContext, CandidateSet candidates);
Matching\Matcher.cs (2)
17/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 19public abstract Task MatchAsync(HttpContext httpContext);
Matching\NegotiationMatcherPolicy.cs (3)
48private protected abstract StringValues GetNegotiationHeader(HttpContext httpContext); 82public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) 400public override int GetDestination(HttpContext httpContext)
Matching\PolicyJumpTable.cs (2)
16/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 17public abstract int GetDestination(HttpContext httpContext);
RequestDelegateFilterPipelineBuilder.cs (1)
54return async (HttpContext httpContext) =>
RouteBase.cs (2)
289private void EnsureBinder(HttpContext context) 299private void EnsureLoggers(HttpContext context)
RouteCollection.cs (1)
191private void EnsureOptions(HttpContext context)
RouteConstraintMatcher.cs (2)
28/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 39HttpContext httpContext,
RouteHandler.cs (1)
27public RequestDelegate GetRequestHandler(HttpContext httpContext, RouteData routeData)
RouterMiddleware.cs (2)
40/// <param name="httpContext">A <see cref="HttpContext"/> instance.</param> 41public async Task Invoke(HttpContext httpContext)
src\Shared\HttpExtensions.cs (2)
36internal static Endpoint? GetOriginalEndpoint(HttpContext context) 49internal static void ClearEndpoint(HttpContext context)
src\Shared\RouteHandlers\ExecuteHandlerHelper.cs (2)
12public static Task ExecuteReturnAsync(object obj, HttpContext httpContext, JsonTypeInfo<object> jsonTypeInfo) 31public static void SetPlaintextContentType(HttpContext httpContext)
Template\TemplateBinder.cs (2)
426/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 431public bool TryProcessConstraints(HttpContext? httpContext, RouteValueDictionary combinedValues, out string? parameterName, out IRouteConstraint? constraint)
Microsoft.AspNetCore.Routing.Abstractions (24)
IRouteConstraint.cs (1)
36HttpContext? httpContext,
IRouteHandler.cs (2)
17/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 22RequestDelegate GetRequestHandler(HttpContext httpContext, RouteData routeData);
LinkGenerator.cs (6)
29/// Generates a URI with an absolute path based on the provided values and <see cref="HttpContext"/>. 32/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 47HttpContext httpContext, 77/// Generates an absolute URI based on the provided values and <see cref="HttpContext"/>. 80/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 110HttpContext httpContext,
RouteContext.cs (4)
18/// <param name="httpContext">The <see cref="Http.HttpContext"/> associated with the current request.</param> 19public RouteContext(HttpContext httpContext) 33/// Gets the <see cref="Http.HttpContext"/> associated with the current request. 35public HttpContext HttpContext { get; }
RoutingHttpContextExtensions.cs (5)
12/// Extension methods for <see cref="HttpContext"/> related to routing. 19/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 21public static RouteData GetRouteData(this HttpContext httpContext) 33/// <param name="httpContext">The <see cref="HttpContext"/> associated with the current request.</param> 36public static object? GetRouteValue(this HttpContext httpContext, string key)
VirtualPathContext.cs (6)
16/// <param name="httpContext">The <see cref="Http.HttpContext"/> associated with the current request.</param> 20HttpContext httpContext, 30/// <param name="httpContext">The <see cref="Http.HttpContext"/> associated with the current request.</param> 35HttpContext httpContext, 52/// Gets the <see cref="Http.HttpContext"/> associated with the current request. 54public HttpContext HttpContext { get; }
Microsoft.AspNetCore.Routing.Microbenchmarks (28)
EndpointRoutingBenchmarkBase.cs (3)
19private protected HttpContext[] Requests; 68private protected void Validate(HttpContext httpContext, Endpoint expected, Endpoint actual) 126protected (HttpContext httpContext, RouteValueDictionary ambientValues) CreateCurrentRequestContext(
EndpointRoutingShortCircuitBenchmark.cs (1)
90public override Task MatchAsync(HttpContext httpContext)
LinkGeneration\LinkGenerationGithubBenchmark.cs (1)
15private (HttpContext HttpContext, RouteValueDictionary AmbientValues) _requestContext;
LinkGeneration\LinkGenerationGithubBenchmark.generated.cs (1)
265Requests = new HttpContext[243];
LinkGeneration\SingleRouteRouteValuesAddressSchemeBenchmark.cs (1)
14private (HttpContext HttpContext, RouteValueDictionary AmbientValues) _requestContext;
LinkGeneration\SingleRouteWithConstraintsBenchmark.cs (1)
15private (HttpContext HttpContext, RouteValueDictionary AmbientValues) _requestContext;
LinkGeneration\SingleRouteWithNoParametersBenchmark.cs (1)
15private (HttpContext HttpContext, RouteValueDictionary AmbientValues) _requestContext;
LinkGeneration\SingleRouteWithParametersBenchmark.cs (1)
15private (HttpContext HttpContext, RouteValueDictionary AmbientValues) _requestContext;
Matching\MatcherAzureBenchmark.cs (2)
40var httpContext = Requests[sample]; 52var httpContext = Requests[sample];
Matching\MatcherAzureBenchmarkBase.generated.cs (1)
5181Requests = new HttpContext[5160];
Matching\MatcherBuilderMultipleEntryBenchmark.cs (2)
162public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates) 179public Task ApplyAsync(HttpContext httpContext, CandidateSet candidates)
Matching\MatcherGithubBenchmark.cs (2)
32var httpContext = Requests[i]; 43var httpContext = Requests[i];
Matching\MatcherGithubBenchmarkBase.generated.cs (1)
264Requests = new HttpContext[243];
Matching\MatcherSingleEntryBenchmark.cs (5)
23Requests = new HttpContext[1]; 43var httpContext = Requests[0]; 52var httpContext = Requests[0]; 61var httpContext = Requests[0]; 70var httpContext = Requests[0];
Matching\TrivialMatcher.cs (1)
23public sealed override Task MatchAsync(HttpContext httpContext)
src\Http\Routing\test\UnitTests\Matching\BarebonesMatcher.cs (2)
20public override Task MatchAsync(HttpContext httpContext) 113public override Task MatchAsync(HttpContext httpContext)
src\Http\Routing\test\UnitTests\Matching\RouteMatcher.cs (1)
18public override async Task MatchAsync(HttpContext httpContext)
src\Http\Routing\test\UnitTests\Matching\TreeRouterMatcher.cs (1)
19public override async Task MatchAsync(HttpContext httpContext)
Microsoft.AspNetCore.Routing.Tests (317)
Builder\GroupTest.cs (3)
28group.MapGet("/{id}", (int id, HttpContext httpContext) => 59group.MapGet("/{id}", (string org, int id, HttpContext httpContext) => 93group.MapGet("/", (string org, int id, HttpContext httpContext) =>
Builder\RequestDelegateEndpointRouteBuilderExtensionsTest.cs (13)
88static async Task<string> GenericTypeTaskDelegate(HttpContext context) 125Assert.IsAssignableFrom<HttpContext>(Assert.Single(invocationContext.Arguments)); 195var httpContext = Assert.IsAssignableFrom<HttpContext>(Assert.Single(invocationContext.Arguments)); 205var httpContext = Assert.IsAssignableFrom<HttpContext>(Assert.Single(invocationContext.Arguments)); 233var @delegate = (HttpContext context) => context.Items.Add("param", "Value"); 268RequestDelegate requestDelegate = (HttpContext context) => Task.CompletedTask; 302if (context.Arguments[0] is HttpContext httpContext) 526private static Task Handle(HttpContext context) => Task.CompletedTask; 529private static Task HandleHttpMetdata(HttpContext context) => Task.CompletedTask; 558public Task ExecuteAsync(HttpContext httpContext) => throw new NotImplementedException(); 563public static ValueTask<AddsCustomParameterMetadata?> BindAsync(HttpContext context, ParameterInfo parameter) => default;
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,
Constraints\CompositeRouteConstraintTests.cs (1)
37It.IsAny<HttpContext>(),
Constraints\RegexRouteConstraintTests.cs (1)
122httpContext: new Mock<HttpContext>().Object,
DefaultInlineConstraintResolverTest.cs (2)
384public bool Match(HttpContext httpContext, 402public bool Match(HttpContext 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);
DefaultLinkGeneratorTest.cs (13)
138var httpContext = CreateHttpContext(); 271var httpContext = CreateHttpContext(); 366var httpContext = CreateHttpContext(); 413var httpContext = CreateHttpContext(); 438var httpContext = CreateHttpContext(); 462var httpContext = CreateHttpContext(); 486var httpContext = CreateHttpContext(); 509var httpContext = CreateHttpContext(); 537var httpContext = CreateHttpContext(); 556public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection) 633var httpContext = CreateHttpContext(); 672var httpContext = CreateHttpContext(); 711var httpContext = CreateHttpContext();
DefaultParameterPolicyFactoryTest.cs (2)
422public HttpContext HttpContext { get; private set; } 434HttpContext httpContext,
EndpointRoutingMiddlewareFormOptionsTest.cs (5)
30var httpContext = CreateHttpContext(); 62var httpContext = CreateHttpContext(); 102var httpContext = httpContextFactory.Create( new DefaultHttpContext().Features); 134var httpContext = CreateHttpContext(); 189private HttpContext CreateHttpContext()
EndpointRoutingMiddlewareTest.cs (3)
74Assert.IsAssignableFrom<HttpContext>(pair.Value); 414endpoints.MapGet("/", (HttpContext c) => Task.CompletedTask); 454private HttpContext CreateHttpContext()
InlineRouteParameterParserTests.cs (1)
977public bool Match(HttpContext httpContext,
LinkGeneratorEndpointNameExtensionsTest.cs (3)
26var httpContext = CreateHttpContext(); 76var httpContext = CreateHttpContext(); 127var httpContext = CreateHttpContext();
LinkGeneratorIntegrationTest.cs (23)
216var httpContext = CreateHttpContext(); 237var httpContext = CreateHttpContext(); 258var httpContext = CreateHttpContext(); 279var httpContext = CreateHttpContext(); 300var httpContext = CreateHttpContext(); 321var httpContext = CreateHttpContext(); 342var httpContext = CreateHttpContext(); 367var httpContext = CreateHttpContext(); 388var httpContext = CreateHttpContext(); 409var httpContext = CreateHttpContext(); 430var httpContext = CreateHttpContext(); 451var httpContext = CreateHttpContext(); 472var httpContext = CreateHttpContext(); 493var httpContext = CreateHttpContext(); 514var httpContext = CreateHttpContext(); 535var httpContext = CreateHttpContext(); 556var httpContext = CreateHttpContext(); 577var httpContext = CreateHttpContext(); 598var httpContext = CreateHttpContext(); 619var httpContext = CreateHttpContext(); 640var httpContext = CreateHttpContext(); 661var httpContext = CreateHttpContext(); 682var httpContext = CreateHttpContext();
LinkGeneratorRouteValuesAddressExtensionsTest.cs (4)
32var httpContext = CreateHttpContext(); 90var httpContext = CreateHttpContext(); 149var httpContext = CreateHttpContext(); 181var httpContext = CreateHttpContext(new { controller = "Home", });
LinkGeneratorTestBase.cs (1)
14protected HttpContext CreateHttpContext(object ambientValues = null)
Matching\BarebonesMatcher.cs (2)
20public override Task MatchAsync(HttpContext httpContext) 113public override Task MatchAsync(HttpContext httpContext)
Matching\DataSourceDependentMatcherTest.cs (1)
257public override Task MatchAsync(HttpContext httpContext)
Matching\DefaultEndpointSelectorTest.cs (8)
19var httpContext = CreateContext(); 40var httpContext = CreateContext(); 61var httpContext = CreateContext(); 82var httpContext = CreateContext(); 104var httpContext = CreateContext(); 135var httpContext = CreateContext(); 157var httpContext = CreateContext(); 170private static HttpContext CreateContext()
Matching\DfaMatcherConformanceTest.cs (2)
16var httpContext = CreateContext(path); 48var httpContext = CreateContext(path);
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\FullFeaturedMatcherConformanceTest.cs (18)
26var httpContext = CreateContext(path); 41var httpContext = CreateContext("/a"); 56var httpContext = CreateContext("/a"); 81var httpContext = CreateContext(path); 113var httpContext = CreateContext(path); 136var httpContext = CreateContext(path); 160var httpContext = CreateContext(path); 180var httpContext = CreateContext(path); 215var httpContext = CreateContext(path); 235var httpContext = CreateContext(path); 264var httpContext = CreateContext(path); 290var httpContext = CreateContext(path); 315var httpContext = CreateContext(path); 345var httpContext = CreateContext(path); 379var httpContext = CreateContext(path); 432var httpContext = CreateContext(path); 462var httpContext = CreateContext("/file/folder/abc/abc"); 493var httpContext = CreateContext("/file/folder/abc/abc");
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(
Matching\MatcherAssert.cs (6)
26public static void AssertMatch(HttpContext httpContext, Endpoint expected) 31public static void AssertMatch(HttpContext httpContext, Endpoint expected, bool ignoreValues) 36public static void AssertMatch(HttpContext httpContext, Endpoint expected, object values) 41public static void AssertMatch(HttpContext httpContext, Endpoint expected, string[] keys, string[] values) 56HttpContext httpContext, 94public static void AssertNotMatch(HttpContext httpContext)
Matching\MatcherConformanceTest.cs (1)
14internal static HttpContext CreateContext(string path)
Matching\MatcherConformanceTest.SingleEndpoint.cs (17)
13var httpContext = CreateContext("/"); 27var httpContext = CreateContext("/simple"); 41var httpContext = CreateContext("/simple/"); 58var httpContext = CreateContext(path); 75var httpContext = CreateContext(path); 93var httpContext = CreateContext(path); 113var httpContext = CreateContext(path); 130var httpContext = CreateContext("/simple"); 153var httpContext = CreateContext(path); 184var httpContext = CreateContext(path); 198var httpContext = CreateContext("/14"); 213var httpContext = CreateContext("/14"); 228var httpContext = CreateContext("/14/"); 243var httpContext = CreateContext("/foo/space/weirdmatch/matcherid"); 267var httpContext = CreateContext(path); 288var httpContext = CreateContext(path); 317var httpContext = CreateContext(path);
Matching\RouteMatcher.cs (1)
18public override async Task MatchAsync(HttpContext httpContext)
Matching\RouteMatcherConformanceTest.cs (1)
32var httpContext = CreateContext(path);
Matching\TreeRouterMatcher.cs (1)
19public override async Task MatchAsync(HttpContext httpContext)
Matching\TreeRouterMatcherConformanceTest.cs (1)
46var httpContext = CreateContext(path);
RequestDelegateRouteBuilderExtensionsTest.cs (6)
17public static TheoryData<Action<IRouteBuilder>, Action<HttpContext>> MatchingActions 21return new TheoryData<Action<IRouteBuilder>, Action<HttpContext>>() 45Action<HttpContext> requestSetup) 65public static TheoryData<Action<IRouteBuilder>, Action<HttpContext>> NonmatchingActions 69return new TheoryData<Action<IRouteBuilder>, Action<HttpContext>>() 103Action<HttpContext> requestSetup)
RouteCollectionTest.cs (2)
608var context = new Mock<HttpContext>(MockBehavior.Strict); 662var context = new Mock<HttpContext>(MockBehavior.Strict);
RouteConstraintBuilderTest.cs (1)
170httpContext: new Mock<HttpContext>().Object,
RouteEndpointBuilderTest.cs (3)
83static Task RequestDelegate(HttpContext d) => null; 103static Task RequestDelegate(HttpContext d) => null; 124static Task RequestDelegate(HttpContext d) => null;
RouteOptionsTests.cs (1)
68HttpContext httpContext,
RouteTest.cs (2)
591var context = new Mock<HttpContext>(MockBehavior.Strict); 959It.IsAny<HttpContext>(),
RoutingMetricsTests.cs (5)
35var httpContext = CreateHttpContext(); 69var httpContext = CreateHttpContext(); 96var httpContext = CreateHttpContext(); 120var httpContext = CreateHttpContext(); 176private HttpContext CreateHttpContext()
RoutingServiceCollectionExtensionsTests.cs (1)
56public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
TestObjects\CapturingConstraint.cs (1)
13HttpContext httpContext,
TestObjects\TestMatcher.cs (3)
12private readonly Action<HttpContext> _setEndpointCallback; 14public TestMatcher(bool isHandled, Action<HttpContext> setEndpointCallback = null) 26public override Task MatchAsync(HttpContext httpContext)
TestObjects\TestMatcherFactory.cs (3)
15private readonly Action<HttpContext> _setEndpointCallback; 17public TestMatcherFactory(bool isHandled, Action<HttpContext> setEndpointCallback = null) 61public override Task MatchAsync(HttpContext httpContext)
Tree\TreeRouterTest.cs (2)
1989var context = new Mock<HttpContext>(MockBehavior.Strict); 2003var mockHttpContext = new Mock<HttpContext>();
Microsoft.AspNetCore.Security.Microbenchmarks (1)
ChunkingCookieManagerBenchmark.cs (1)
15private HttpContext _httpContext;
Microsoft.AspNetCore.Server.HttpSys (1)
AuthenticationHandler.cs (1)
36public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (4)
DummyApplication.cs (4)
12internal class DummyApplication : IHttpApplication<HttpContext> 23public HttpContext CreateContext(IFeatureCollection contextFeatures) 28public void DisposeContext(HttpContext httpContext, Exception exception) 33public async Task ProcessRequestAsync(HttpContext httpContext)
Microsoft.AspNetCore.Server.HttpSys.NonHelixTests (4)
DummyApplication.cs (4)
10internal class DummyApplication : IHttpApplication<HttpContext> 21public HttpContext CreateContext(IFeatureCollection contextFeatures) 26public void DisposeContext(HttpContext httpContext, Exception exception) 31public async Task ProcessRequestAsync(HttpContext httpContext)
Microsoft.AspNetCore.Server.IIS (8)
Core\IISServerAuthenticationHandlerInternal.cs (2)
16private HttpContext? _context; 58public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
HttpContextExtensions.cs (2)
10/// Extensions to <see cref="HttpContext"/> that enable access to IIS features. 25public static string? GetIISServerVariable(this HttpContext context, string variableName) =>
IISServerOptions.cs (2)
16/// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>
src\Shared\RazorViews\BaseView.cs (2)
28protected HttpContext Context { get; private set; } = default!; 80public async Task ExecuteAsync(HttpContext context)
Microsoft.AspNetCore.Server.IISIntegration (7)
AuthenticationHandler.cs (2)
14private HttpContext? _context; 48public Task InitializeAsync(AuthenticationScheme scheme, HttpContext context)
IISMiddleware.cs (5)
99/// <param name="httpContext">The <see cref="HttpContext"/>.</param> 101public Task Invoke(HttpContext httpContext) 170private static WindowsPrincipal? GetUser(HttpContext context) 194var context = (HttpContext)arg;
Microsoft.AspNetCore.Server.Kestrel.Core (3)
Internal\Http\HttpProtocol.cs (1)
122/// The request id. <seealso cref="HttpContext.TraceIdentifier"/>
KestrelServerOptions.cs (2)
113/// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (11)
PooledStreamStackTests.cs (2)
97private static Http2Stream<HttpContext> CreateStream(int streamId, long expirationTimestamp) 101return new Http2Stream<HttpContext>(new DummyApplication(), context)
src\Servers\Kestrel\shared\test\DummyApplication.cs (4)
12public class DummyApplication : IHttpApplication<HttpContext> 33public HttpContext CreateContext(IFeatureCollection contextFeatures) 38public void DisposeContext(HttpContext context, Exception exception) 43public async Task ProcessRequestAsync(HttpContext context)
src\Servers\Kestrel\shared\test\TestApp.cs (5)
14public static async Task EchoApp(HttpContext httpContext) 27public static async Task EchoAppChunked(HttpContext httpContext) 39public static Task EmptyApp(HttpContext httpContext) 44public static async Task EchoAppPipeWriter(HttpContext httpContext) 61public static async Task EchoAppPipeWriterChunked(HttpContext httpContext)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (13)
Http2\Http2ConnectionBenchmarkBase.cs (1)
39protected abstract Task ProcessRequest(HttpContext httpContext);
Http2\Http2ConnectionEmptyBenchmark.cs (1)
24protected override Task ProcessRequest(HttpContext httpContext)
Http2\Http2ConnectionHeadersBenchmark.cs (1)
33protected override Task ProcessRequest(HttpContext httpContext)
Http3\Http3ConnectionBenchmarkBase.cs (1)
25protected abstract Task ProcessRequest(HttpContext httpContext);
Http3\Http3ConnectionEmptyBenchmark.cs (1)
24protected override Task ProcessRequest(HttpContext httpContext)
InMemoryTransportBenchmark.cs (1)
249public Task Invoke(HttpContext httpContext)
Mocks\MockHttpContextFactory.cs (2)
15public HttpContext Create(IFeatureCollection featureCollection) 31public void Dispose(HttpContext httpContext)
NamedPipesTransportBenchmark.cs (1)
147public Task Invoke(HttpContext httpContext)
src\Servers\Kestrel\shared\test\DummyApplication.cs (4)
12public class DummyApplication : IHttpApplication<HttpContext> 33public HttpContext CreateContext(IFeatureCollection contextFeatures) 38public void DisposeContext(HttpContext context, Exception exception) 43public async Task ProcessRequestAsync(HttpContext context)
Microsoft.AspNetCore.Session (4)
SessionMiddleware.cs (4)
58/// <param name="context">The <see cref="HttpContext"/>.</param> 60public async Task Invoke(HttpContext context) 116private readonly HttpContext _context; 121public SessionEstablisher(HttpContext context, string cookieValue, SessionOptions options)
Microsoft.AspNetCore.SignalR (7)
GetHttpContextExtensions.cs (7)
10/// Extension methods for accessing <see cref="HttpContext"/> from a hub context. 15/// Gets <see cref="HttpContext"/> from the specified connection, or <c>null</c> if the connection is not associated with an HTTP request. 18/// <returns>The <see cref="HttpContext"/> for the connection, or <c>null</c> if the connection is not associated with an HTTP request.</returns> 19public static HttpContext? GetHttpContext(this HubCallerContext connection) 26/// Gets <see cref="HttpContext"/> from the specified connection, or <c>null</c> if the connection is not associated with an HTTP request. 29/// <returns>The <see cref="HttpContext"/> for the connection, or <c>null</c> if the connection is not associated with an HTTP request.</returns> 30public static HttpContext? GetHttpContext(this HubConnectionContext connection)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (2)
Hubs.cs (1)
59var context = Context.GetHttpContext();
Startup.cs (1)
117endpoints.MapGet("/generateJwtToken/{name?}", (HttpContext context, string name) =>
Microsoft.AspNetCore.SignalR.Tests (3)
HubConnectionHandlerTests.cs (2)
5399public HttpContext HttpContext { get; set; } 5427public HttpContext HttpContext { get; set; }
Startup.cs (1)
105private string GenerateToken(HttpContext httpContext)
Microsoft.AspNetCore.SpaProxy (2)
SpaProxyMiddleware.cs (2)
44public Task Invoke(HttpContext context) 53private async Task InvokeCore(HttpContext context)
Microsoft.AspNetCore.SpaServices.Extensions (7)
Prerendering\SpaPrerenderingOptions.cs (1)
42public Action<HttpContext, IDictionary<string, object>> SupplyData { get; set; }
Proxying\ConditionalProxyMiddleware.cs (2)
43public Task Invoke(HttpContext context) 52private async Task InvokeCore(HttpContext context)
Proxying\SpaProxy.cs (4)
55HttpContext context, 129private static HttpRequestMessage CreateProxyHttpRequest(HttpContext context, Uri uri) 165private static async Task CopyProxyHttpResponse(HttpContext context, HttpResponseMessage responseMessage, CancellationToken cancellationToken) 209private static async Task<bool> AcceptProxyWebSocketRequest(HttpContext context, Uri destinationUri, CancellationToken cancellationToken)
Microsoft.AspNetCore.SpaServices.Extensions.Tests (1)
SpaProxyTests.cs (1)
19private static (HttpContext, HttpClient) GetHttpContextAndClient(string path, string queryString, Action<HttpRequestMessage> callback)
Microsoft.AspNetCore.StaticAssets (12)
Development\StaticAssetDevelopmentRuntimeHandler.cs (5)
69private readonly HttpContext _context; 72public RuntimeStaticAssetResponseBodyFeature(IHttpResponseBodyFeature original, HttpContext context, StaticAssetDescriptor asset) 206var ctx = (HttpContext)context; 312public bool Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
src\Shared\RangeHelper\RangeHelper.cs (4)
18/// Provides a parser for the Range Header in an <see cref="HttpContext.Request"/>. 23/// Returns the normalized form of the requested range if the Range Header in the <see cref="HttpContext.Request"/> is valid. 25/// <param name="context">The <see cref="HttpContext"/> associated with the request.</param> 35HttpContext context,
StaticAssetsInvoker.cs (3)
127public async Task Invoke(HttpContext context) 254private readonly HttpContext _context = null!; 263HttpContext context,
Microsoft.AspNetCore.StaticFiles (20)
DefaultFilesMiddleware.cs (1)
49public Task Invoke(HttpContext context)
DirectoryBrowserMiddleware.cs (1)
61public Task Invoke(HttpContext context)
Helpers.cs (2)
41internal static void RedirectToPathWithSlash(HttpContext context) 49internal static bool TryMatchPath(HttpContext context, PathString matchUrl, bool forDirectory, out PathString subpath)
HtmlDirectoryFormatter.cs (1)
35public virtual Task GenerateContentAsync(HttpContext context, IEnumerable<IFileInfo> contents)
IDirectoryFormatter.cs (1)
19Task GenerateContentAsync(HttpContext context, IEnumerable<IFileInfo> contents);
src\Shared\RangeHelper\RangeHelper.cs (4)
18/// Provides a parser for the Range Header in an <see cref="HttpContext.Request"/>. 23/// Returns the normalized form of the requested range if the Range Header in the <see cref="HttpContext.Request"/> is valid. 25/// <param name="context">The <see cref="HttpContext"/> associated with the request.</param> 35HttpContext context,
StaticFileContext.cs (3)
18private readonly HttpContext _context; 44public StaticFileContext(HttpContext context, StaticFileOptions options, ILogger logger, IFileProvider fileProvider, string? contentType, PathString subPath) 304public async Task ServeStaticFile(HttpContext context, RequestDelegate next)
StaticFileMiddleware.cs (5)
58public Task Invoke(HttpContext context) 86private static bool ValidateNoEndpointDelegate(HttpContext context) => context.GetEndpoint()?.RequestDelegate is null; 88private static bool ValidateMethod(HttpContext context) 93internal static bool ValidatePath(HttpContext context, PathString matchUrl, out PathString subPath) => Helpers.TryMatchPath(context, matchUrl, forDirectory: false, out subPath); 111private Task TryServeStaticFile(HttpContext context, string? contentType, PathString subPath)
StaticFileResponseContext.cs (2)
19public StaticFileResponseContext(HttpContext context, IFileInfo file) 28public HttpContext Context { get; }
Microsoft.AspNetCore.StaticFiles.FunctionalTests (4)
src\Shared\RangeHelper\RangeHelper.cs (4)
18/// Provides a parser for the Range Header in an <see cref="HttpContext.Request"/>. 23/// Returns the normalized form of the requested range if the Range Header in the <see cref="HttpContext.Request"/> is valid. 25/// <param name="context">The <see cref="HttpContext"/> associated with the request.</param> 35HttpContext context,
Microsoft.AspNetCore.TestHost (23)
ClientHandler.cs (5)
23private readonly Action<HttpContext> _additionalContextConfiguration; 31/// <param name="additionalContextConfiguration">The action to additionally configure <see cref="HttpContext"/>.</param> 32internal ClientHandler(PathString pathBase, ApplicationWrapper application, Action<HttpContext>? additionalContextConfiguration = null) 210var httpContext = await contextBuilder.SendAsync(cancellationToken); 230private static void NoExtraConfiguration(HttpContext context)
HttpContextBuilder.cs (7)
14private readonly HttpContext _httpContext; 16private readonly TaskCompletionSource<HttpContext> _responseTcs = new TaskCompletionSource<HttpContext>(TaskCreationOptions.RunContinuationsAsynchronously); 27private Action<HttpContext>? _responseReadCompleteCallback; 61internal void Configure(Action<HttpContext, PipeReader> configureContext) 75internal void RegisterResponseReadCompleteCallback(Action<HttpContext> responseReadCompleteCallback) 84internal Task<HttpContext> SendAsync(CancellationToken cancellationToken)
TestServer.cs (6)
132/// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>. The default value is <see langword="false" />. 163public HttpMessageHandler CreateHandler(Action<HttpContext> additionalContextConfiguration) 204/// Creates, configures, sends, and returns a <see cref="HttpContext"/>. This completes as soon as the response is started. 207public async Task<HttpContext> SendAsync(Action<HttpContext> configureContext, CancellationToken cancellationToken = default)
TestServerOptions.cs (2)
14/// Gets or sets a value that controls whether synchronous IO is allowed for the <see cref="HttpContext.Request"/> and <see cref="HttpContext.Response"/>. The default value is <see langword="false" />.
WebSocketClient.cs (3)
97var httpContext = await contextBuilder.SendAsync(cancellationToken); 122private readonly HttpContext _httpContext; 124public WebSocketFeature(HttpContext context)
Microsoft.AspNetCore.TestHost.Tests (15)
ClientHandlerTests.cs (1)
686public HttpContext HttpContext { get; set; }
HttpContextBuilderTests.cs (12)
23var context = await server.SendAsync(c => 54var context = await server.SendAsync(c => 68var context = await server.SendAsync(c => 89var context = await server.SendAsync(c => { }); 114var context = await task; 135var context = await server.SendAsync(c => { }); 159var context = await server.SendAsync(c => { }); 183var context = await server.SendAsync(c => { }); 205var context = await server.SendAsync(c => { }); 254var context = await server.SendAsync(c => { }); 295var context = await server.SendAsync(c => { }); 324var ctx = await server.SendAsync(c => { });
TestServerTests.cs (2)
401public Task Invoke(HttpContext httpContext) 562var logger = app.ApplicationServices.GetRequiredService<ILogger<HttpContext>>();
Microsoft.AspNetCore.Testing.Tests (1)
TestResources\Startup.cs (1)
19public void Configure(IApplicationBuilder app) => app.Use((HttpContext _, Func<Task> _) => Task.CompletedTask);
Microsoft.AspNetCore.Tests (2)
WebApplicationTests.cs (2)
2843public Task InvokeAsync(HttpContext context, RequestDelegate next) 2908app.Use((HttpContext context, RequestDelegate next) =>
Microsoft.AspNetCore.WebSockets (10)
AbortStream.cs (4)
10/// Used in <see cref="WebSocketMiddleware"/> to wrap the <see cref="HttpContext"/>.Request.Body stream 11/// so that we can call <see cref="HttpContext.Abort"/> when the stream is disposed and the WebSocket is in the <see cref="WebSocketState.Aborted"/> state. 23private readonly HttpContext _httpContext; 27public AbortStream(HttpContext httpContext, Stream innerStream)
WebSocketMiddleware.cs (6)
19/// to the <see cref="HttpContext"/> if the request is a valid WebSocket request. 52/// sets the <see cref="IHttpWebSocketFeature"/> on the <see cref="HttpContext.Features"/>. 54/// <param name="context">The <see cref="HttpContext"/> representing the request.</param> 56public Task Invoke(HttpContext context) 91private readonly HttpContext _context; 99public WebSocketHandshake(HttpContext context, IHttpUpgradeFeature? upgradeFeature, IHttpExtendedConnectFeature? connectFeature, WebSocketOptions options, ILogger logger)
Microsoft.AspNetCore.WebSockets.Tests (1)
KestrelWebSocketHelpers.cs (1)
18public static IAsyncDisposable CreateServer(ILoggerFactory loggerFactory, out int port, Func<HttpContext, Task> app, Action<WebSocketOptions> configure = null)
MiddlewareAnalysisSample (2)
Startup.cs (2)
101public virtual void OnMiddlewareStarting(HttpContext httpContext, string name) 113public virtual void OnMiddlewareFinished(HttpContext httpContext, string name)
MinimalFormSample (1)
Program.cs (1)
16app.MapGet("/antiforgery", (HttpContext context, IAntiforgery antiforgery) =>
MinimalSample (1)
Program.cs (1)
106public static ValueTask<TodoBindable?> BindAsync(HttpContext context, ParameterInfo parameter)
Mvc.RoutingWebSite (6)
QueryStringConstraint.cs (1)
8public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
StartupForDynamic.cs (2)
49public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values) 65public override ValueTask<IReadOnlyList<Endpoint>> FilterAsync(HttpContext httpContext, RouteValueDictionary values, IReadOnlyList<Endpoint> endpoints)
StartupForDynamicAndRazorPages.cs (1)
35public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
StartupForDynamicOrder.cs (1)
89public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
StartupRoutingDifferentBranches.cs (1)
93public override ValueTask<RouteValueDictionary> TransformAsync(HttpContext httpContext, RouteValueDictionary values)
NegotiateAuthSample (1)
Startup.cs (1)
55public async Task HandleRequest(HttpContext context)
OpenIdConnectSample (1)
Startup.cs (1)
30private void CheckSameSite(HttpContext httpContext, CookieOptions options)
OutputCachingSample (1)
Gravatar.cs (1)
6public static async Task WriteGravatar(HttpContext context)
RateLimitingSample (2)
Program.cs (1)
37options.GlobalLimiter = PartitionedRateLimiter.Create<HttpContext, string>(context =>
SampleRateLimiterPolicy.cs (1)
26public RateLimitPartition<string> GetPartition(HttpContext httpContext)
RazorPagesWebSite (2)
Pages\ShortCircuitPageAtAuthFilter.cshtml.cs (1)
19private static bool ShouldShortCircuit(HttpContext httpContext, string currentTargetName)
Pages\ShortCircuitPageAtPageFilter.cshtml.cs (1)
19private static bool ShouldShortCircuit(HttpContext httpContext, string currentTargetName)
RoutingSandbox (3)
HelloExtension\HelloMiddleware.cs (1)
30public Task InvokeAsync(HttpContext context)
UseEndpointRoutingStartup.cs (2)
96private Task HandlerWithAttributes(HttpContext context) 102private Task Handler(HttpContext context)
RoutingWebSite (2)
EndsWithStringRouteConstraint.cs (1)
17public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection)
HelloExtension\HelloMiddleware.cs (1)
30public Task InvokeAsync(HttpContext context)
SecurityWebSite (1)
CountingPolicyEvaluator.cs (1)
16public override Task<PolicyAuthorizationResult> AuthorizeAsync(AuthorizationPolicy policy, AuthenticateResult authenticationResult, HttpContext context, object resource)
ServerComparison.TestSites (1)
OneTransformPerRequest.cs (1)
23var context = ContextAccessor.HttpContext;
SocialSample (1)
Startup.cs (1)
468private Task<OAuthOptions> GetOAuthOptionsAsync(HttpContext context, string currentAuthType)
SocialWeather (1)
PersistentConnectionLifeTimeManager.cs (1)
45var context = connection.GetHttpContext();
Sockets.FunctionalTests (10)
src\Servers\Kestrel\shared\test\TestApp.cs (5)
14public static async Task EchoApp(HttpContext httpContext) 27public static async Task EchoAppChunked(HttpContext httpContext) 39public static Task EmptyApp(HttpContext httpContext) 44public static async Task EchoAppPipeWriter(HttpContext httpContext) 61public static async Task EchoAppPipeWriterChunked(HttpContext httpContext)
src\Servers\Kestrel\test\FunctionalTests\ResponseTests.cs (5)
522async Task App(HttpContext context) 777async Task App(HttpContext context) 879async Task App(HttpContext context) 956async Task App(HttpContext context) 1043async Task App(HttpContext context)
StaticFilesAuth (2)
Startup.cs (2)
45if (context.Resource is HttpContext httpContext && httpContext.GetEndpoint() is Endpoint endpoint) 121private static void SetFileEndpoint(HttpContext context, PhysicalFileProvider files, string policy)
WebPubSubWeb (1)
Program.cs (1)
53app.Map($"/eventhandler/{Constants.ChatHubName}", async ([FromKeyedServices(Constants.ChatHubName)] WebPubSubServiceClient service, HttpContext context, ILogger logger) => {