216 references to TypedResults
Aspire.Dashboard (1)
DashboardWebApplication.cs (1)
438_app.MapPost("/authentication/logout", () => TypedResults.SignOut(authenticationSchemes: [CookieAuthenticationDefaults.AuthenticationScheme, OpenIdConnectDefaults.AuthenticationScheme]));
Keycloak.Web (2)
LoginLogoutEndpointRouteBuilderExtensions.cs (2)
13group.MapGet("/login", () => TypedResults.Challenge(new AuthenticationProperties { RedirectUri = "/" })) 16group.MapPost("/logout", () => TypedResults.SignOut(new AuthenticationProperties { RedirectUri = "/" },
Microsoft.AspNetCore.Http.Results (59)
Results.cs (59)
41=> TypedResults.Challenge(properties, authenticationSchemes); 59=> TypedResults.Forbid(properties, authenticationSchemes); 72=> TypedResults.SignIn(principal, properties, authenticationScheme); 81=> TypedResults.SignOut(properties, authenticationSchemes); 116=> TypedResults.Content(content, contentType, contentEncoding, statusCode); 151=> TypedResults.Text(content, contentType, contentEncoding, statusCode); 161=> TypedResults.Text(utf8Content, contentType, statusCode); 170=> TypedResults.Content(content, contentType); 243=> TypedResults.Json(data, options, contentType, statusCode); 259=> TypedResults.Json(data, jsonTypeInfo, contentType, statusCode); 275=> TypedResults.Json(data, context, contentType, statusCode); 300=> TypedResults.File(fileContents, contentType, fileDownloadName, enableRangeProcessing, lastModified, entityTag); 325=> TypedResults.Bytes(contents, contentType, fileDownloadName, enableRangeProcessing, lastModified, entityTag); 348=> TypedResults.Bytes(contents, contentType, fileDownloadName, enableRangeProcessing, lastModified, entityTag); 379=> TypedResults.File(fileStream, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 410=> TypedResults.Stream(stream, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 438=> TypedResults.Stream(pipeReader, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 457=> TypedResults.Stream(streamWriterCallback, contentType, fileDownloadName, lastModified, entityTag); 481? TypedResults.PhysicalFile(path, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing) 482: TypedResults.VirtualFile(path, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 506=> TypedResults.Redirect(url, permanent, preserveMethod); 530=> TypedResults.LocalRedirect(localUrl, permanent, preserveMethod); 557=> TypedResults.RedirectToRoute(routeName, routeValues, permanent, preserveMethod, fragment); 585=> TypedResults.RedirectToRoute(routeName, routeValues, permanent, preserveMethod, fragment); 593=> TypedResults.StatusCode(statusCode); 609=> value is null ? TypedResults.NotFound() : TypedResults.NotFound(value); 616=> TypedResults.Unauthorized(); 632=> error is null ? TypedResults.BadRequest() : TypedResults.BadRequest(error); 648=> error is null ? TypedResults.Conflict() : TypedResults.Conflict(error); 655=> TypedResults.NoContent(); 671=> value is null ? TypedResults.Ok() : TypedResults.Ok(value); 687=> error is null ? TypedResults.UnprocessableEntity() : TypedResults.UnprocessableEntity(error); 702=> error is null ? TypedResults.InternalServerError() : TypedResults.InternalServerError(error); 721=> TypedResults.Problem(detail, instance, statusCode, title, type, extensions); 742=> TypedResults.Problem(detail, instance, statusCode, title, type, extensions); 750=> TypedResults.Problem(problemDetails); 814return TypedResults.Problem(problemDetails); 833=> TypedResults.Created(); 851=> value is null ? TypedResults.Created(uri) : TypedResults.Created(uri, value); 869=> value is null ? TypedResults.Created(uri) : TypedResults.Created(uri, value); 903=> value is null ? TypedResults.CreatedAtRoute(routeName, routeValues) : TypedResults.CreatedAtRoute(value, routeName, routeValues); 915=> value is null ? TypedResults.CreatedAtRoute(routeName, routeValues) : TypedResults.CreatedAtRoute(value, routeName, routeValues); 933=> value is null ? TypedResults.Accepted(uri) : TypedResults.Accepted(uri, value); 967=> value is null ? TypedResults.AcceptedAtRoute(routeName, routeValues) : TypedResults.AcceptedAtRoute(value, routeName, routeValues); 979=> value is null ? TypedResults.AcceptedAtRoute(routeName, routeValues) : TypedResults.AcceptedAtRoute(value, routeName, routeValues); 984public static IResult Empty { get; } = TypedResults.Empty;
Microsoft.AspNetCore.Http.Results.Tests (111)
ResultsTests.cs (1)
374Assert.Throws<ArgumentNullException>("streamWriterCallback", () => TypedResults.Stream(default(Func<Stream, Task>)));
TypedResultsTests.cs (110)
30var result = TypedResults.Accepted(uri, value); 45var result = TypedResults.Accepted(uri); 59var result = TypedResults.Accepted(uri); 74var result = TypedResults.Accepted(uri, value); 89var result = TypedResults.Accepted(uri); 99Assert.Throws<ArgumentNullException>("uri", () => TypedResults.Accepted(default(Uri))); 105Assert.Throws<ArgumentNullException>("uri", () => TypedResults.Accepted(default(Uri), default(object))); 117var result = TypedResults.AcceptedAtRoute(value, routeName, routeValues); 134var result = TypedResults.AcceptedAtRoute(routeName, routeValues); 148var result = TypedResults.AcceptedAtRoute(null, null); 162var result = TypedResults.AcceptedAtRoute<object>(null, null, null); 174var result = TypedResults.AcceptedAtRoute(); 189var result = TypedResults.AcceptedAtRoute(routeValues: routeValues); 205var result = TypedResults.AcceptedAtRoute(value: value, routeValues: routeValues); 221var result = TypedResults.BadRequest(value); 232var result = TypedResults.BadRequest(); 2480 => TypedResults.Bytes(contents, contentType, fileDownloadName, enableRangeProcessing, lastModified, entityTag), 249_ => TypedResults.File(contents, contentType, fileDownloadName, enableRangeProcessing, lastModified, entityTag) 277var result = TypedResults.PhysicalFile(path, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 296var result = TypedResults.VirtualFile(path, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing); 318Assert.Throws<ArgumentNullException>("contents", () => TypedResults.Bytes(null)); 324Assert.Throws<ArgumentNullException>("fileContents", () => TypedResults.File(default(byte[]))); 330Assert.Throws<ArgumentNullException>("fileStream", () => TypedResults.File(default(Stream))); 336Assert.Throws<ArgumentNullException>("stream", () => TypedResults.Stream(default(Stream))); 342Assert.Throws<ArgumentNullException>("pipeReader", () => TypedResults.Stream(default(PipeReader))); 348Assert.Throws<ArgumentNullException>("streamWriterCallback", () => TypedResults.Stream(default(Func<Stream, Task>))); 354Assert.Throws<ArgumentNullException>("path", () => TypedResults.PhysicalFile(default(string))); 360Assert.Throws<ArgumentException>("path", () => TypedResults.PhysicalFile(string.Empty)); 366Assert.Throws<ArgumentNullException>("path", () => TypedResults.VirtualFile(default(string))); 372Assert.Throws<ArgumentException>("path", () => TypedResults.VirtualFile(string.Empty)); 3850 => TypedResults.Stream(stream, contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing), 3861 => TypedResults.Stream(PipeReader.Create(stream), contentType, fileDownloadName, lastModified, entityTag, enableRangeProcessing), 387_ => (IResult)TypedResults.Stream((s) => Task.CompletedTask, contentType, fileDownloadName, lastModified, entityTag) 430var result = TypedResults.Challenge(properties, authenticationSchemes); 442var result = TypedResults.Forbid(properties, authenticationSchemes); 454var result = TypedResults.SignOut(properties, authenticationSchemes); 469var result = TypedResults.SignIn(principal, properties, authenticationSchemes?.First()); 488Assert.Throws<ArgumentNullException>("principal", () => TypedResults.SignIn(null)); 498var result = TypedResults.Conflict(value); 509var result = TypedResults.Conflict(); 523var result = TypedResults.Content(content, mediaType); 540var result = TypedResults.Content(content, contentType, encoding); 558var result = TypedResults.Content(content, contentType, encoding, statusCode); 570var result = TypedResults.Created(); 585var result = TypedResults.Created(uri, value); 600var result = TypedResults.Created(uri); 615var result = TypedResults.Created(uri, value); 630var result = TypedResults.Created(uri); 641var result = TypedResults.Created(default(string)); 650var result = TypedResults.Created(string.Empty); 658var result = TypedResults.Created(default(Uri)); 666var result = TypedResults.Created(default(string), default(object)); 676var result = TypedResults.Created(string.Empty, default(object)); 686var result = TypedResults.Created(default(Uri), default(object)); 701var result = TypedResults.CreatedAtRoute(value, routeName, routeValues); 718var result = TypedResults.CreatedAtRoute(value, routeName, null); 734var result = TypedResults.CreatedAtRoute(routeName, default(object)); 746var result = TypedResults.CreatedAtRoute(); 761var result = TypedResults.CreatedAtRoute(routeValues: routeValues); 777var result = TypedResults.CreatedAtRoute(value: value, routeValues: routeValues); 792var result = TypedResults.CreatedAtRoute(null, null); 806var result = TypedResults.CreatedAtRoute<object>(null, null, null); 818var result = TypedResults.Empty; 834var result = TypedResults.Json(data, options, contentType, statusCode); 850var result = TypedResults.Json(data); 866var result = TypedResults.Json(data, ObjectJsonContext.Default.Object); 883var result = TypedResults.Json(data, ObjectJsonContext.Default); 899Assert.Throws<ArgumentNullException>("context", () => TypedResults.Json(data, context: null)); 905var ex = Assert.Throws<InvalidOperationException>(() => TypedResults.Json(string.Empty, context: ObjectJsonContext.Default)); 915Assert.Throws<ArgumentNullException>("jsonTypeInfo", () => TypedResults.Json(data, jsonTypeInfo: null)); 921Assert.Throws<ArgumentNullException>("localUrl", () => TypedResults.LocalRedirect(default(string))); 927Assert.Throws<ArgumentException>("localUrl", () => TypedResults.LocalRedirect(string.Empty)); 937var result = TypedResults.LocalRedirect(localUrl); 954var result = TypedResults.LocalRedirect(localUrl, permanent); 972var result = TypedResults.LocalRedirect(localUrl, permanent, preserveMethod); 990var result = TypedResults.LocalRedirect(localUrl, permanent, preserveMethod); 1003var result = TypedResults.NoContent(); 1016var result = TypedResults.NotFound(value); 1027var result = TypedResults.NotFound(); 1040var result = TypedResults.Ok(value); 1051var result = TypedResults.Ok(); 1060Assert.Throws<ArgumentNullException>("problemDetails", () => TypedResults.Problem(default(ProblemDetails))); 1075var result = TypedResults.Problem(detail, instance, statusCode, title, type, extensions); 1099var result = TypedResults.Problem(detail, instance, statusCode, title, type, extensions); 1120var result = TypedResults.Problem(statusCode: statusCode); 1137var result = TypedResults.Problem(); 1156var result = TypedResults.Problem(problem); 1172var result = TypedResults.Problem(problem); 1184Assert.Throws<ArgumentNullException>("errors", () => TypedResults.ValidationProblem(default(IDictionary<string, string[]>))); 1199var result = TypedResults.ValidationProblem(errors, detail, instance, title, type, extensions); 1225var result = TypedResults.ValidationProblem(errors, detail, instance, title, type, extensions); 1242Assert.Throws<ArgumentNullException>("url", () => TypedResults.Redirect(default(string))); 1248Assert.Throws<ArgumentException>("url", () => TypedResults.Redirect(string.Empty)); 1258var result = TypedResults.Redirect(url); 1274var result = TypedResults.Redirect(url, true); 1290var result = TypedResults.Redirect(url, false, true); 1308var result = TypedResults.RedirectToRoute(routeName, routeValues, true, true, fragment); 1322var result = TypedResults.RedirectToRoute(); 1336var result = TypedResults.RedirectToRoute(routeValues: routeValues); 1349var result = TypedResults.RedirectToRoute(null, null); 1363var result = TypedResults.StatusCode(statusCode); 1377var result = TypedResults.Text(content, contentType); 1393var result = TypedResults.Text(content, contentType); 1410var result = TypedResults.Text(content, contentType, statusCode); 1427var result = TypedResults.Text(content, contentType, encoding); 1447var result = TypedResults.Text(content, contentType, encoding, statusCode); 1461var result = TypedResults.Unauthorized(); 1471var result = TypedResults.UnprocessableEntity(); 1484var result = TypedResults.InternalServerError(value); 1495var result = TypedResults.InternalServerError();
Microsoft.AspNetCore.Identity (21)
IdentityApiEndpointRouteBuilderExtensions.cs (21)
87return TypedResults.Ok(); 115return TypedResults.Problem(result.ToString(), statusCode: StatusCodes.Status401Unauthorized); 119return TypedResults.Empty; 135return TypedResults.Challenge(); 139return TypedResults.SignIn(newPrincipal, authenticationScheme: IdentityConstants.BearerScheme); 149return TypedResults.Unauthorized(); 158return TypedResults.Unauthorized(); 181return TypedResults.Unauthorized(); 184return TypedResults.Text("Thank you for confirming your email."); 199return TypedResults.Ok(); 203return TypedResults.Ok(); 222return TypedResults.Ok(); 255return TypedResults.Ok(); 267return TypedResults.NotFound(); 326return TypedResults.Ok(new TwoFactorResponse 342return TypedResults.NotFound(); 345return TypedResults.Ok(await CreateInfoResponseAsync(user, userManager)); 354return TypedResults.NotFound(); 387return TypedResults.Ok(await CreateInfoResponseAsync(user, userManager)); 425TypedResults.ValidationProblem(new Dictionary<string, string[]> { 454return TypedResults.ValidationProblem(errorDictionary);
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (6)
EndpointMetadataApiDescriptionProviderTest.cs (6)
281TypedResults.Created("https://example.com", new InferredJsonClass())); 306var apiDescription = GetApiDescription(() => TypedResults.Created("https://example.com", new InferredJsonClass())); 324var apiDescription = GetApiDescription(() => TypedResults.Problem()); 339Task.FromResult(TypedResults.Created("https://example.com", new InferredJsonClass()))); 392? TypedResults.Created<InferredJsonClass>("/", new InferredJsonClass()) 393: TypedResults.Problem();
Microsoft.AspNetCore.OpenApi.Tests (6)
Services\OpenApiGeneratorTests.cs (1)
873var operation = GetOpenApiOperation(() => TypedResults.Ok(new InferredJsonClass()),
Services\OpenApiSchemaService\OpenApiSchemaService.ResponseSchemas.cs (4)
384builder.MapGet("/api", () => TypedResults.Created("/test/1", new { Id = 1, Name = "Test", Todo = new Todo(1, "Test", true, DateTime.Now) })); 447builder.MapGet("/", () => TypedResults.Ok<List<Todo>>([new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)])); 494builder.MapGet("/", () => TypedResults.Ok<PaginatedItems<Todo>>(new(0, 1, 5, 50, [new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)]))); 574builder.MapGet("/", () => TypedResults.ValidationProblem(new Dictionary<string, string[]>
Transformers\Implementations\OpenApiSchemaReferenceTransformerTests.cs (1)
73builder.MapPost("/api", (Todo todo) => TypedResults.Ok(todo));
MinimalSample (5)
Program.cs (5)
74<= 0 => TypedResults.BadRequest(), 75>= 1 and <= 10 => TypedResults.Ok(new Todo(id, "Walk the dog")), 76_ => TypedResults.NotFound() 89"validationTyped" => TypedResults.ValidationProblem(errors, extensions: extensions), 90_ => TypedResults.NotFound()
Sample (5)
Program.cs (5)
99schemas.MapGet("/typed-results", () => TypedResults.Ok(new Triangle { Color = "red", Sides = 3, Hypotenuse = 5.0 })); 101? TypedResults.Ok(new Triangle { Color = "red", Sides = 3, Hypotenuse = 5.0 }) 102: TypedResults.NotFound<string>("Item not found.")); 107schemas.MapGet("/product", (Product product) => TypedResults.Ok(product)); 108schemas.MapGet("/account", (Account account) => TypedResults.Ok(account));