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

ImATeapotResult missing #5947

Closed
shravan2x opened this issue Mar 12, 2017 · 6 comments
Closed

ImATeapotResult missing #5947

shravan2x opened this issue Mar 12, 2017 · 6 comments
Labels

Comments

@shravan2x
Copy link

shravan2x commented Mar 12, 2017

This is serious missing functionality in MVC 6. I'm aware we can do StatusCode(418);, but we need to be able to do return ImATeapot();.

Adding this would make the lives of teapot programmers a lot better.

On a side note:

  1. We also need a MethodNotFound().
  2. When a corresponding action with the right method is not found in a controller, a 405 should be sent instead of a 404 (See this).
  3. We need the ability to send custom status descriptions (200 OK, 500 I'm fine, 404 Eaten by dog, 404 Abducted by aliens, etc).
@shravan2x shravan2x changed the title ImATeapotResult ImATeapotResult missing Mar 12, 2017
@Eilon
Copy link
Member

Eilon commented Mar 13, 2017

Sorry, April 1st is still a couple weeks away! 😄

@Eilon Eilon closed this as completed Mar 13, 2017
@Eilon Eilon added the wontfix label Mar 13, 2017
@shravan2x
Copy link
Author

@Eilon Can we currently send custom status descriptions? I tried return StatusCode(404, "Something"); but that wasn't quite right.

@Eilon
Copy link
Member

Eilon commented Mar 14, 2017

@shravan2x I don't believe that's supported because it's not standard or something like that. @Tratcher would know more.

@Eilon
Copy link
Member

Eilon commented Mar 14, 2017

Some info here: aspnet/HttpAbstractions#395

@shravan2x
Copy link
Author

shravan2x commented Mar 14, 2017

From what I gather, the main reason for it being removed is that it is not standard and HTTP/2 removes it. This is a fairly good reason, but some points:

  1. HTTP 1.1 is not going away anytime soon.
  2. The majority of browsers don't care about the status description, allowing servers to modify them without an issue.
  3. Enabling simpler usage allows us to play around with them, perhaps as an April fools joke or such. I'm considering using custom status descriptions to return "fun" status descriptions along with my 404s, like 404 Eaten by dog, 404 Abducted by aliens, etc.
  4. There seem to be many requests for it Add back StatusDescription to HttpStatusCodeResult #3455, Missing Properties in HttpResponse class HttpAbstractions#486, HttpStatusCodeResult return description along with code? #3820, add custom response support BasicMiddleware#200.

I understand we would ideally abstract the entire feature away, but could there not just be an overload to allow its modification? (One idea is return StatusCode(404, null, "Eaten by dog");)

@Eilon
Copy link
Member

Eilon commented Mar 14, 2017

Hey, I'm all for April Fools jokes, but unfortunately we have to balance the desire to have fun with the desire to ship this product 😄

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

No branches or pull requests

2 participants