Asp Net Core Httpdelete With Body

[Solved] Asp Net Core Httpdelete With Body | Vb - Code Explorer | yomemimo.com
Question : asp.net core httpdelete with body

Answered by : curious-cockroach-bhzswxl5jrsf

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 : https://stackoverflow.com/questions/51347953/asp-net-core-http-delete-frombody-ignore-if-no-content-type-header | Last Update : Tue, 22 Jun 21

Answers related to asp net core httpdelete with body

Code Explorer Popular Question For Vb