200 references to MapGet
DefaultBuilder.SampleApp (1)
Program.cs (1)
15app.MapGet("/", (Func<string>)(() => "Hello, World!"));
GetDocumentSample (2)
Program.cs (2)
19app.MapGet("/hello/{name}", (string name) => $"Hello {name}!"); 20app.MapGet("/bye/{name}", (string name) => $"Bye {name}!")
IdentitySample.ApiEndpoints (2)
Program.cs (2)
24app.MapGet("/", () => "Hello, World!"); 25app.MapGet("/requires-auth", (ClaimsPrincipal user) => $"Hello, {user.Identity?.Name}!").RequireAuthorization();
Microsoft.AspNetCore.Diagnostics.Tests (5)
DeveloperExceptionPageMiddlewareTest.cs (2)
104endpoint.MapGet("/test/{id}", (int id) => 163endpoint.MapGet("/test/{id}", (int id) =>
StatusCodeMiddlewareTest.cs (3)
266endpoints.MapGet("/errorPage", () => "errorPage"); 338endpoints.MapGet("/status", (HttpResponse response) => $"Status: {response.StatusCode}"); 376endpoints.MapGet("/status", (HttpResponse response) => $"Status: {response.StatusCode}");
Microsoft.AspNetCore.HttpLogging.Tests (9)
HttpLoggingMiddlewareTests.cs (9)
1925endpoint.MapGet("/", async (HttpContext c) => 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.Identity (2)
IdentityApiEndpointRouteBuilderExtensions.cs (2)
142routeGroup.MapGet("/confirmEmail", async Task<Results<ContentHttpResult, UnauthorizedHttpResult>> 334accountGroup.MapGet("/info", async Task<Results<Ok<InfoResponse>, ValidationProblem, NotFound>>
Microsoft.AspNetCore.Identity.FunctionalTests (2)
MapIdentityApiTests.cs (2)
1304authGroup.MapGet("/hello", 1307authGroup.MapGet("/claims", (ClaimsPrincipal user) => user.Claims.Select(c => new { c.Type, c.Value }));
Microsoft.AspNetCore.Mvc.ApiExplorer.Test (11)
EndpointMetadataApiDescriptionProviderTest.cs (11)
667builder.MapGet("/api/todos", () => "").ProducesProblem(StatusCodes.Status400BadRequest); 692builder.MapGet("/api/todos", () => "").Produces<InferredJsonClass>().WithGroupName(endpointGroupName); 717builder.MapGet("/api/todos", () => "").Produces<InferredJsonClass>().ExcludeFromDescription(); 739builder.MapGet("/api/todos", () => "") 791builder.MapGet("/api/todos", () => "") 892builder.MapGet("/api/todos", [ProducesResponseType(typeof(List<string>), StatusCodes.Status200OK)] () => "") 1194builder.MapGet("/api/todos/{name}", GetName); 1234builder.MapGet("/api/todos/{name:minlength(8):guid:maxlength(20)}", (string name) => ""); 1262builder.MapGet("/api/todos/{id}", (int id) => "").WithDescription("A description").WithSummary("A summary"); 1293builder.MapGet("/api/todos/{id}", [EndpointSummary("A summary")][EndpointDescription("A description")] (int id) => ""); 1327builder.MapGet(pattern, (int Id) => "");
Microsoft.AspNetCore.OpenApi (1)
Extensions\OpenApiEndpointRouteBuilderExtensions.cs (1)
31return endpoints.MapGet(pattern, async (HttpContext context, string documentName = OpenApiConstants.DefaultDocumentName) =>
Microsoft.AspNetCore.OpenApi.Microbenchmarks (5)
GenerationBenchmarks.cs (2)
29_builder.MapGet("/", () => { }); 32_builder.MapGet($"/{i}", (int i) => new Todo(1, "Write benchmarks", false, DateTime.Now));
TransformersBenchmark.cs (3)
30_builder.MapGet("/", () => { }); 45_builder.MapGet("/", () => { }); 56_builder.MapGet("/", () => { });
Microsoft.AspNetCore.OpenApi.Tests (79)
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Operations.cs (11)
20builder.MapGet("/api/todos", () => { }).WithSummary(summary); 38builder.MapGet("/api/todos", () => { }).WithSummary(summary).WithSummary(summary + "1"); 56builder.MapGet("/api/todos", () => { }).WithDescription(description); 74builder.MapGet("/api/todos", () => { }).WithDescription(description).WithDescription(description + "1"); 91builder.MapGet("/api/todos", () => { }).WithTags(["todos", "v1"]); 115builder.MapGet("/api/todos", () => { }).WithTags(["todos", "v1"]).WithTags(["todos", "v2"]); 139builder.MapGet("/api/todos", () => { }); 163builder.MapGet("/api/todos", () => { }).WithTags(["todos", "v1"]); 164builder.MapGet("/api/users", () => { }).WithTags(["users", "v1"]); 191builder.MapGet("/api/todos", () => { }).WithName("GetTodos"); 209builder.MapGet("/api/todos", [EndpointName("GetTodos")] () => { });
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Parameters.cs (15)
18builder.MapGet("/api/todos/{id}", (int id) => { }); 19builder.MapGet("/api/todos", (int id) => { }); 20builder.MapGet("/api", ([FromHeader(Name = "X-Header")] string header) => { }); 47builder.MapGet("/api/todos/{id}", (int id) => { }); 48builder.MapGet("/api/todos/{guid}", (Guid? guid) => { }); 49builder.MapGet("/api/todos/{isCompleted}", (bool isCompleted = false) => { }); 73builder.MapGet("/api/todos", (int id) => { }); 74builder.MapGet("/api/users", (int? id) => { }); 75builder.MapGet("/api/projects", (int id = 1) => { }); 99builder.MapGet("/api/todos", ([FromHeader(Name = "X-Header")] string header) => { }); 100builder.MapGet("/api/users", ([FromHeader(Name = "X-Header")] Guid? header) => { }); 101builder.MapGet("/api/projects", ([FromHeader(Name = "X-Header")] string header = "0000-0000-0000-0000") => { }); 128builder.MapGet("/api/todos/{id}", (int id) => { }); 129builder.MapGet("/api/todos/{guid}", (Guid? guid) => { }); 130builder.MapGet("/api/todos/{isCompleted}", (bool isCompleted = false) => { });
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Paths.cs (7)
17builder.MapGet("/api/todos", () => { }); 18builder.MapGet("/api/users", () => { }); 52builder.MapGet("/api/todos", () => { }).WithMetadata(new EndpointGroupNameAttribute("v1")); 53builder.MapGet("/api/users", () => { }).WithMetadata(new EndpointGroupNameAttribute("v2")); 77builder.MapGet("/api/todos", () => { }); 108builder.MapGet("/api/todos/{id}", () => { }); 148builder.MapGet("/api/todos/{id:int}", () => { });
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.RequestBody.cs (1)
730builder.MapGet("/resume", ([FromForm] ResumeUpload model) => { });
Services\OpenApiDocumentService\OpenApiDocumentServiceTests.Responses.cs (10)
18builder.MapGet("/api/todos", 49builder.MapGet("/api/todos", () => { }) 70builder.MapGet("/api/todos", () => { }) 95builder.MapGet("/api/todos", () => { }) 121builder.MapGet("/api/todos", () => { }) 150builder.MapGet("/api/todos", () => { }) 176builder.MapGet("/api/todos", () => { }); 195builder.MapGet("/api/todos", [Produces("application/json", "application/xml")] () => new Todo(1, "Test todo", false, DateTime.Now)); 223builder.MapGet("/api/todos", [ProducesDefaultResponseType(typeof(Error))] () => { }); 255builder.MapGet("/api/todos", [ProducesDefaultResponseType(typeof(Error))] () => { })
Services\OpenApiSchemaService\OpenApiComponentService.RequestBodySchemas.cs (1)
119builder.MapGet("/array-parsable", (Guid[] guids) => { });
Services\OpenApiSchemaService\OpenApiComponentService.ResponseSchemas.cs (10)
36builder.MapGet("/api", requestHandler); 57builder.MapGet("/api", () => new Todo(1, "Test Title", true, DateTime.Now)); 102builder.MapGet("/api", GetTodo); 146builder.MapGet("/api", () => new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1))); 195builder.MapGet("/api", () => new Result<Todo>(true, new TodoWithDueDate(1, "Test Title", true, DateTime.Now, DateTime.Now.AddDays(1)), null)); 260builder.MapGet("/api", () => new Boat { Length = 10, Make = "Type boat", Wheels = 0 }); 299builder.MapGet("/api", () => TypedResults.Created("/test/1", new { Id = 1, Name = "Test", Todo = new Todo(1, "Test", true, DateTime.Now) })); 359builder.MapGet("/", () => TypedResults.Ok<List<Todo>>([new Todo(1, "Test Title", true, DateTime.Now), new Todo(2, "Test Title 2", false, DateTime.Now)])); 404builder.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)]))); 481builder.MapGet("/", () => TypedResults.ValidationProblem(new Dictionary<string, string[]>
Transformers\DocumentTransformerTests.cs (12)
17builder.MapGet("/todo", () => { }); 18builder.MapGet("/user", () => { }); 44builder.MapGet("/todo", () => { }); 45builder.MapGet("/user", () => { }); 61builder.MapGet("/todo", () => { }); 62builder.MapGet("/user", () => { }); 79builder.MapGet("/todo", () => { }); 105builder.MapGet("/todo", () => { }); 130builder.MapGet("/todo", () => { }); 131builder.MapGet("/user", () => { }); 149builder.MapGet("/todo", () => { }); 150builder.MapGet("/user", () => { });
Transformers\OperationTransformerTests.cs (7)
14builder.MapGet("/todo", () => { }); 15builder.MapGet("/user", () => { }); 48builder.MapGet("/todo", () => { }); 49builder.MapGet("/user", () => { }); 93builder.MapGet("/todo", () => { }); 94builder.MapGet("/user", () => { }); 132builder.MapGet("/todo", () => { });
Transformers\SchemaTransformerTests.cs (5)
35builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 53builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 71builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 121builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now)); 151builder.MapGet("/todo", () => new Todo(1, "Item1", false, DateTime.Now));
Microsoft.AspNetCore.Routing (1)
RouteHandlerOptions.cs (1)
12/// Options for controlling the behavior of <see cref="EndpointRouteBuilderExtensions.MapGet(IEndpointRouteBuilder, string, Delegate)"/>
Microsoft.AspNetCore.Routing.Tests (15)
Builder\GroupTest.cs (12)
28group.MapGet("/{id}", (int id, HttpContext httpContext) => 59group.MapGet("/{id}", (string org, int id, HttpContext httpContext) => 93group.MapGet("/", (string org, int id, HttpContext httpContext) => 125builder.MapGroup("/{ID}").MapGroup("/{id}").MapGet("/", () => { }); 158inner.MapGet("/foo", () => "Hello World!"); 186group.MapGet("/foo", () => "Hello World!"); 209group.MapGet("/", () => 242group.MapGet("/foo", () => "Hello World!"); 265group.MapGet("/", () => 323inner.MapGet("/foo", () => "Hello World!").WithMetadata("/foo"); 340group.MapGet("/foo", () => "foo"); 341group.MapGet("/bar", () => "bar");
Builder\RouteHandlerEndpointRouteBuilderExtensionsTest.cs (3)
35routes.MapGet(template, action); 1027group.MapGet("/endpoint", () => { }).Finally(b => b.Metadata.Add("added-from-endpoint")); 1059var handler = innerGroup.MapGet("/endpoint", () => { });
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (1)
Startup.cs (1)
117endpoints.MapGet("/generateJwtToken/{name?}", (HttpContext context, string name) =>
Microsoft.AspNetCore.Tests (24)
WebApplicationTests.cs (24)
1579app.MapGet("/new", () => "new"); 1618app.MapGet("/1", () => "1"); 1669app.MapGet("/defined", () => { }); 1864app.MapGet("/", () => "Hello World!").WithDisplayName("One"); 1868routes.MapGet("/hi", () => "Hi World").WithDisplayName("Two"); 1869routes.MapGet("/heyo", () => "Heyo World").WithDisplayName("Three"); 1899app.MapGet("/", () => "Hello World").WithDisplayName("One"); 1903endpoints.MapGet("/hi", () => "Hello Endpoints").WithDisplayName("Two"); 1955app.MapGet("/", () => "Hello World!").WithDisplayName("One"); 1964routes.MapGet("/heyo", () => "Heyo World").WithDisplayName("Three"); 2031app.MapGet("/", void () => throw new InvalidOperationException("BOOM")); 2083app.MapGet("/", void () => throw new InvalidOperationException("BOOM")); 2137app.MapGet("/{parameterName}", (int parameterName) => { }); 2162app.MapGet("/{parameterName}", (int parameterName) => { }); 2460app.MapGet("/hello", (ClaimsPrincipal user) => 2501app.MapGet("/hello", (ClaimsPrincipal user) => { }).AllowAnonymous(); 2551app.MapGet("/products/{productId:regex(^[a-z]{{4}}\\d{{4}}$)}", (string productId) => productId).WithDisplayName("RegexRoute"); 2577app.MapGet("/products/{productId:alpha:minlength(4):maxlength(4)}", (string productId) => productId).WithDisplayName("AlphaRoute"); 2595app.MapGet("/products/{productId:regex(^[a-z]{{4}}\\d{{4}}$)}", (string productId) => productId).WithDisplayName("AlphaRoute"); 2630app.MapGet("/products/{productId:regex(^[a-z]{{4}}\\d{{4}}$)}", (string productId) => productId).WithDisplayName("RegexRoute"); 2660app.MapGet("/products/{productId:regex(^[a-z]{{4}}\\d{{4}}$)}", (string productId) => productId).WithDisplayName("RegexRoute"); 2740app.MapGet("/hello", () => "hello world"); 2803app.MapGet("/hello", () => "hello world"); 2826endpoints.MapGet("/hello", () => "hello world");
MinimalFormSample (2)
Program.cs (2)
16app.MapGet("/antiforgery", (HttpContext context, IAntiforgery antiforgery) => 35app.MapGet("/no-antiforgery", () =>
MinimalJwtBearerSample (2)
Program.cs (2)
22app.MapGet("/protected", (ClaimsPrincipal user) => $"Hello {user.Identity?.Name}!") 25app.MapGet("/protected-with-claims", (ClaimsPrincipal user) =>
MinimalOpenIdConnectSample (1)
Program.cs (1)
15app.MapGet("/protected", (ClaimsPrincipal user) => $"Hello {user.Identity?.Name}!")
MinimalSample (11)
Program.cs (11)
15app.MapGet("/plaintext", Plaintext); 17app.MapGet("/", () => $""" 41outer.MapGet("/outerget", () => "I'm nested."); 42inner.MapGet("/innerget", () => "I'm more nested."); 59superNested.MapGet("/", (string groupName, string nestedName) => 65app.MapGet("/json", Json).WithTags("json"); 68app.MapGet("/hello/{name}", SayHello); 70app.MapGet("/null-result", IResult () => null!); 72app.MapGet("/todo/{id}", Results<Ok<Todo>, NotFound, BadRequest> (int id) => id switch 83app.MapGet("/problem/{problemType}", (string problemType) => problemType switch 95app.MapGet("/todos", () => new Todo[] { new Todo(1, "Walk the dog"), new Todo(2, "Come back home") });
MvcSandbox (1)
Startup.cs (1)
25endpoints.MapGet("/MapGet", () => "MapGet");
RateLimitingSample (4)
Program.cs (4)
53app.MapGet("/", () => "Hello World!").RequireRateLimiting(helloName); 56app.MapGet("/todoitems", async (TodoDb db) => 61app.MapGet("/todoitems/complete", async (TodoDb db) => 65app.MapGet("/todoitems/{id}", async (int id, TodoDb db) =>
Sample (8)
EndpointRouteBuilderExtensions.cs (1)
11return endpoints.MapGet("/swagger/{documentName}", (string documentName) => Results.Content($$"""
Program.cs (7)
66v1.MapGet("/array-of-guids", (Guid[] guids) => guids); 70v1.MapGet("/todos/{id}", (int id) => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now)) 73v2.MapGet("/users", () => new [] { "alice", "bob" }) 78responses.MapGet("/200-add-xml", () => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now)) 81responses.MapGet("/200-only-xml", () => new TodoWithDueDate(1, "Test todo", false, DateTime.Now.AddDays(1), DateTime.Now)) 84responses.MapGet("/triangle", () => new Triangle { Color = "red", Sides = 3, Hypotenuse = 5.0 }); 85responses.MapGet("/shape", () => new Shape { Color = "blue", Sides = 4 });
SignalR.Client.FunctionalTestApp (1)
Startup.cs (1)
244endpoints.MapGet("/clientresult/{id}", async (IHubContext<TestHub> hubContext, string id) =>
SimpleWebSiteWithWebApplicationBuilder (9)
Program.cs (9)
22app.MapGet("/", () => "Hello World"); 24app.MapGet("/json", () => Json(new Person("John", 42))); 26app.MapGet("/ok-object", () => Ok(new Person("John", 42))); 28app.MapGet("/accepted-object", () => Accepted("/ok-object", new Person("John", 42))); 30app.MapGet("/many-results", (int id) => 40app.MapGet("/problem", () => Results.Problem("Some problem")); 42app.MapGet("/environment", (IHostEnvironment environment) => environment.EnvironmentName); 43app.MapGet("/webroot", (IWebHostEnvironment environment) => environment.WebRootPath); 45app.MapGet("/greeting", (IConfiguration config) => config["Greeting"]);
SimpleWebSiteWithWebApplicationBuilderException (1)
Program.cs (1)
6app.MapGet("/", (Func<string>)(() => "Hello World"));