Scenario: implementing a standard REST API / GET method on a .net core controller.
The documentation states that OkObjectResult is an ObjectResult with status 200. T
I can only see the difference in relying on some default value somewhere and providing this value explicitly - the latter is usually better and your intention is much more clear with OkObjectResult
(or setting StatusCode
explicitly), which is important enough.
ObjectResult
does not have default StatusCode
of 200 - it actually have this value null by default. However, HttpResponse
has default status code 200, so it works the same anyway.