-
Notifications
You must be signed in to change notification settings - Fork 9.8k
/
HttpPostAttribute.cs
33 lines (28 loc) · 1.01 KB
/
HttpPostAttribute.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// 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 POST method.
/// </summary>
public class HttpPostAttribute : HttpMethodAttribute
{
private static readonly IEnumerable<string> _supportedMethods = new[] { "POST" };
/// <summary>
/// Creates a new <see cref="HttpPostAttribute"/>.
/// </summary>
public HttpPostAttribute()
: base(_supportedMethods)
{
}
/// <summary>
/// Creates a new <see cref="HttpPostAttribute"/> with the given route template.
/// </summary>
/// <param name="template">The route template. May not be null.</param>
public HttpPostAttribute([StringSyntax("Route")] string template)
: base(_supportedMethods, template)
{
ArgumentNullException.ThrowIfNull(template);
}
}