400 Bad request indicates that the server did not understand the
request and that the client should not repeat it without modification.
I'd say it doesn't really matter what status code you use internally,
but 403 Forbidden is probably more expressive for this situation.
403 indicates that the server understood the request, but is refusing
to fulfill it.

- Sævar

On Oct 12, 7:37 pm, Oliver Andrich <oandr...@googlemail.com> wrote:
> Hi,
>
> I want to add an require_XHR decorator to my project. The implementation is
> pretty straightforward.
>
> def require_XHR(f):
>     @wraps(f)
>     def wrapper(request, *args, **kwargs):
>         if not request.is_ajax():
>             return HttpResponseBadRequest()
>         return f(request, *args, **kwargs)
>     return wrapper
>
> But the question is, is Bad Request (HTTP Status Code 400) the best choice?
> Which response code do you use in such a situation?
>
> Best regards,
> Oliver

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to