Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

asp.net core httpdelete with body

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<IActionResult> Delete([FromBody]RequestData request)
{
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #core #httpdelete #body
ADD COMMENT
Topic
Name
1+7 =