| File: HttpGetAttribute.cs | Web Access |
| Project: src\aspnetcore\src\Mvc\Mvc.Core\src\Microsoft.AspNetCore.Mvc.Core.csproj (Microsoft.AspNetCore.Mvc.Core) |
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc.Routing; namespace Microsoft.AspNetCore.Mvc; /// <summary> /// Identifies an action that supports the HTTP GET method. /// </summary> public class HttpGetAttribute : HttpMethodAttribute { private static readonly IEnumerable<string> _supportedMethods = new[] { "GET" }; /// <summary> /// Creates a new <see cref="HttpGetAttribute"/>. /// </summary> public HttpGetAttribute() : base(_supportedMethods) { } /// <summary> /// Creates a new <see cref="HttpGetAttribute"/> with the given route template. /// </summary> /// <param name="template">The route template. May not be null.</param> public HttpGetAttribute([StringSyntax("Route")] string template) : base(_supportedMethods, template) { ArgumentNullException.ThrowIfNull(template); } }