According to the RFC7231 standard:
A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.
In my example I am using ASP.NET Core WebApi and I would like to use a request body for an HTTP delete method. Fortunately it works, but I can't find any documentation that confirms that a request body is allowed / supported in ASP.NET Core WebApi.
[HttpDelete("{id}")]
public async Task<ActionResult<bool>> Delete(int id, [FromBody] AnyRequestBodyType body)
{
// Do some checks with the param "body" here.
// If everything is OK, the resource will be deleted.
// Otherwise, I want to return an HTTP 4xx error.
}
Can I be sure that the API will work in future ASP.NET Core WebAPI releases?
Do you have any other suggestions? I don't want to pass the parameter via query string because the AnyRequestBodyType
is "complex" and a url-encoded request would no longer be readable or "manually executeable".