Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

EmptyResult should not set status code (or do anything for that matter) #1156

Closed
pranavkm opened this issue Sep 19, 2014 · 4 comments
Closed
Assignees
Milestone

Comments

@pranavkm
Copy link
Contributor

See Mvc 5: https://aspnetwebstack.codeplex.com/SourceControl/latest#src/System.Web.Mvc/EmptyResult.cs. Today it sets the status code to 204.

@yishaigalatzer
Copy link
Contributor

The question is: When the return value from a method is void or task, what should be the default behavior.

In MVC5 it got converted to a no op (or Empty Result). In MVC 6 we currently convert it to a 204 result, that is controlled by the formatters. A user can return an EmptyResult, write a filter, or change the formatters to work around it.

This was an explicit design choice and not a bug. We can revisit this decision.

@pranavkm
Copy link
Contributor Author

I think that's a separate question - what to do when you return void or Task. If I return EmptyResult from my action, I'd expect it to return 200 (or basically do nothing).

@yishaigalatzer
Copy link
Contributor

Ok I see. Yes we should fix it

@yishaigalatzer
Copy link
Contributor

Moved to sprint backlog

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants