38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNet.Mvc.Routing;
|
|
|
|
namespace Microsoft.AspNet.Mvc
|
|
{
|
|
/// <summary>
|
|
/// Identifies an action that only supports the HTTP PATCH method.
|
|
/// </summary>
|
|
public class HttpPatchAttribute : HttpMethodAttribute
|
|
{
|
|
private static readonly IEnumerable<string> _supportedMethods = new string[] { "PATCH" };
|
|
|
|
/// <summary>
|
|
/// Creates a new <see cref="HttpPatchAttribute"/>.
|
|
/// </summary>
|
|
public HttpPatchAttribute()
|
|
: base(_supportedMethods)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new <see cref="HttpPatchAttribute"/> with the given route template.
|
|
/// </summary>
|
|
/// <param name="template">The route template. May not be null.</param>
|
|
public HttpPatchAttribute(string template)
|
|
: base(_supportedMethods, template)
|
|
{
|
|
if (template == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(template));
|
|
}
|
|
}
|
|
}
|
|
} |