Added an overload for StatusCode which takes a HttpStatusCode paramet…#6902
Added an overload for StatusCode which takes a HttpStatusCode paramet…#6902javiercn merged 2 commits intoaspnet:devfrom dale-palmer:patch-1
Conversation
…er instead of int.
|
This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. We will now review your pull request. |
| /// <returns>The created <see cref="StatusCodeResult"/> object for the response.</returns> | ||
| [NonAction] | ||
| public virtual StatusCodeResult StatusCode(HttpStatusCode statusCode) | ||
| => new StatusCode((int)statusCode); |
There was a problem hiding this comment.
Shouldn't have new?
error CS0246: The type or namespace name 'StatusCode' could not be found (are you missing a using directive or an assembly reference?)
There was a problem hiding this comment.
Yeah this doesn't look quite right. I agree the new needs to be removed because it's just chaining a method call.
There was a problem hiding this comment.
Oops! Sorry, wrote it without a compiler based on something else I was working on. You're absolutely right.
| /// <returns>The created <see cref="StatusCodeResult"/> object for the response.</returns> | ||
| [NonAction] | ||
| public virtual StatusCodeResult StatusCode(HttpStatusCode statusCode) | ||
| => new StatusCode((int)statusCode); |
There was a problem hiding this comment.
Yeah this doesn't look quite right. I agree the new needs to be removed because it's just chaining a method call.
|
Amendment made. |
| /// <param name="statusCode">The status code to set on the response.</param> | ||
| /// <returns>The created <see cref="StatusCodeResult"/> object for the response.</returns> | ||
| [NonAction] | ||
| public virtual StatusCodeResult StatusCode(HttpStatusCode statusCode) |
There was a problem hiding this comment.
Should we also have a public virtual ObjectResult StatusCode(HttpStatusCode statusCode, object value) overload to mirror the int overload?
There was a problem hiding this comment.
I'll file a bug and make it up for grabs
Now takes a HttpStatusCode parameter as well as int.