Reputation: 7688
So, I'm writing a small test that I have been required to complete and I just want to give it some final touches by adding some header status code responses and some other stuff.
Right now, my dilemma is what HTTP status code to choose for my "Unknown command" response after the $_GET['cmd']
has been compared to the existing commands list.
case 404: $text = 'Not Found'; break;
case 405: $text = 'Method Not Allowed'; break;
case 406: $text = 'Not Acceptable'; break;
For which one of the above should I go? And if none, which other?
Upvotes: 0
Views: 560
Reputation: 834
If you have a url like this:
http://example.com/resource?cmd=doesnotexist
and the client issues a GET request for it, 404 would be the appropriate HTTP status code because a url with parameters can be considered a unique resource. That resource either exists or does not.
Upvotes: 1