📜  asp.net core httpdelete with body - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:32.040000             🧑  作者: Mango

代码示例1
public class AddMissingContentType : Attribute, IResourceFilter
{
    public void OnResourceExecuting(ResourceExecutingContext context)
    {
        context.HttpContext.Request.Headers["Content-Type"] = "application/json";
    }

    public void OnResourceExecuted(ResourceExecutedContext context)
    {
    }
}
And add it to your method:

[AddMissingContentType]
[HttpDelete]
public async Task Delete([FromBody]RequestData request)
{
}