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

ObjectResult with status code and null value does not produce the status code #1809

Closed
yishaigalatzer opened this issue Jan 14, 2015 · 2 comments
Assignees
Milestone

Comments

@yishaigalatzer
Copy link
Contributor

When a user return an ObjectResult with status code other than 200 with no content, the HttpNoContentFormatter overrides the status code provided on the result (and set by the result) and instead returns a 204.

Similarly if the user has explicitly set the StatusCode on the Response we have no way to know it and the formatter will override the user setting.

@Tratcher this keep coming up, it will be really nice to have a way to know if the StatusCode was changed by the user.

@yishaigalatzer
Copy link
Contributor Author

When fixing this ignore the status code on the response, but respect the status code from ObjectResult. The NoContentFormatter should still act and short circuit so no json/XML with null is written

@ajaybhargavb
Copy link
Contributor

17aa21d

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

2 participants