Repository: dotnet/aspnetcore
File: src/OpenApi/sample/Controllers/TestController.cs (C#)

Code before:
    {
        return TypedResults.Ok(new MvcTodo("Title", "Description", true));
    }

    [HttpPost]
    [Route("/forms")]
    public IActionResult PostForm([FromForm] MvcTodo todo)
    {
        return Ok(todo);
    }

    [HttpGet]
    [Route("/getcultureinvariant")]
    public Ok<CurrentWeather> GetCurrentWeather()
    {
        return TypedResults.Ok(new CurrentWeather(1.0f));
    }

    [Route("/nohttpmethod")]
    public ActionResult<CurrentWeather> NoHttpMethod()
        => Ok(new CurrentWeather(-100));

    [HttpQuery] // See https://github.com/dotnet/aspnetcore/issues/61089
    [Route("/query")]
    public ActionResult<CurrentWeather> HttpQueryMethod()
        => Ok(new CurrentWeather(0));

    [HttpFoo] // See https://github.com/dotnet/aspnetcore/issues/60914
    [Route("/unsupported")]
    public ActionResult<CurrentWeather> UnsupportedHttpMethod()
        => Ok(new CurrentWeather(100));

    public class HttpQuery() : HttpMethodAttribute(["QUERY"]);

    public class HttpFoo() : HttpMethodAttribute(["FOO"]);

    public class RouteParamsContainer
    {
        [FromRoute]
        public int Id { get; set; }

        [FromRoute]
        [MinLength(5)]
        [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode", Justification = "MinLengthAttribute works without reflection on string properties.")]
        public string? Name { get; set; }
    }

    public record MvcTodo(string Title, string Description, bool IsCompleted);

    public record CurrentWeather([property: Range(-100.5f, 100.5f)] float Temperature = 0.1f);
}

Review comment (suggestion):
I've added this to flush out support for HTTP QUERY being added  https://github.com/dotnet/aspnetcore/issues/61089#issuecomment-3143768724.

Alternatively I can just add `HttpMethod.Query` to the switch in this PR as I'm already touching that method code.


Code after:
    {
        return TypedResults.Ok(new MvcTodo("Title", "Description", true));
    }

    [HttpPost]
    [Route("/forms")]
    public IActionResult PostForm([FromForm] MvcTodo todo)
    {
        return Ok(todo);
    }

    [HttpGet]
    [Route("/getcultureinvariant")]
    public Ok<CurrentWeather> GetCurrentWeather()
    {
        return TypedResults.Ok(new CurrentWeather(1.0f));
    }

    [Route("/nohttpmethod")]
    public ActionResult<CurrentWeather> NoHttpMethod()
        => Ok(new CurrentWeather(-100));

    [HttpQuery]
    [Route("/query")]
    public ActionResult<CurrentWeather> HttpQueryMethod()
        => Ok(new CurrentWeather(0));

    [HttpFoo] // See https://github.com/dotnet/aspnetcore/issues/60914
    [Route("/unsupported")]
    public ActionResult<CurrentWeather> UnsupportedHttpMethod()
        => Ok(new CurrentWeather(100));

    public class HttpQuery() : HttpMethodAttribute(["QUERY"]);

    public class HttpFoo() : HttpMethodAttribute(["FOO"]);

    public class RouteParamsContainer
    {
        [FromRoute]
        public int Id { get; set; }

        [FromRoute]
        [MinLength(5)]
        [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode", Justification = "MinLengthAttribute works without reflection on string properties.")]
        public string? Name { get; set; }
    }

    public record MvcTodo(string Title, string Description, bool IsCompleted);

    public record CurrentWeather([property: Range(-100.5f, 100.5f)] float Temperature = 0.1f);
}