Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What status code should I return for a non AJAX request to an AJAX only URL?

If the URL is requested not using AJAX what status code should be returned? 400?

like image 429
Neil Avatar asked Mar 14 '11 12:03

Neil


1 Answers

I think 403 Forbidden ist best.

501 Not Implemented does not fit well, because the resource is implemented, but just not suited for that kind of request.

400 Bad Request ist not a good choice either, because this implies, according to the spec, that "the request could not be understood by the server due to malformed syntax", which is not the case here.

like image 91
alienhard Avatar answered Sep 28 '22 11:09

alienhard