An ApiController
returns the HTTP status 200 and any content given as parameter to Ok(foo)
is sent. If no parameter is given the status is still 200 but no body is sent.
Some clients expect a body or content when receiving a 200 response. Is there a reason an empty Ok()
does not translate to HTTP status 204 No Content?? Or should there be no parameter-less version of Ok()
? What is best/recommended practice?
HTTP 200 OK and HTTP 204 NO CONTENT are two entirely difference status codes. I would not want my software to suddenly change status codes, just because my output has a certain value. Okay, both are success codes, but still...
If you want to write this yourself, of course, feel free to do so, but do inform the implementing party of the specific status codes returned.