The response for an absent tag page should contain the «404» HTTP status code, not «200»


(Discourse.PRO) #1


The pages for the tags with the «.json» suffix are rendered incorrectly
(Michael Downey) #2

At first this sounds good, but I’m not so sure. There is semantic knowledge in seeing that no posts exists for a tag. Does Google return a 404 when no results are returned from a search?


(Discourse.PRO) #3

Google returns “204” code:

204 No Content
The server successfully processed the request and is not returning any content.


(Michael Downey) #4

That was what I was thinking about … Not sure if it’s 100% accurate either but looks like the best fit for this scenario…


(Felix Freiberger) #5

I think a 404 is more appropriate here.

204 means “your request was processed okay, and there is no result to show you”. That’s good for a search with no results, because you got what you asked for, it just turned out to be empty.

404 means “what you’re looking for never existed or no longer exists”, which seems more suitable for a request for a specific topic (which turned out not to exist).


(Jeff Atwood) #6

Sure sounds good @neil can you add this to your list on tagging?


(Neil Lalonde) #7

I also wasn’t sure if a 20x or 40x error was better, but I now agree that 404 is better. On my list!


(Kane York) #8

204 is certainly wrong - 204 means you have a Content-Length of 0, i.e. no bytes returned.


(Neil Lalonde) #9

The 200 was ok I guess, because it meant that it was a valid tag name but nothing had been tagged with it yet. It’s more helpful to say 404 because the tag doesn’t exist.


(Neil Lalonde) #10

This was done today. Note that it’s still possible to get a 200 response with an empty topic list when filtered by both a category and an existing tag.


(Jeff Atwood) #11