I have endpoint which doesn't have [FromBody] parameter:
[HttpPost("{id:int}/publish")]
public async Task<IActionResult> Publish()
{
<do some stuff>
return Ok();
}
But now I need to add [FromBody] parameter in the way that old code is still able to use this endpoint without parameter:
[HttpPost("{id:int}/publish")]
public async Task<IActionResult> Publish([FromBody] PublishRequest request)
{
<do some stuff>
return Ok();
}
But if I add it in this way and try to call this endpoint with empty body, i got 415 (Unsupported Media Type) response back.
I want to make this change backward compatible. So it should be possible to use this endpoint without request body and content-type header. Is is possible?