johnny wrote: > What I want to do is set HTTP Error manually in my view, when a > request is made to certain url, without post data. > > At a particular url, my view is looking for XML document to be sent > over http, by post. If a request come in without post, I want to > raise an error "405 Method Not Allowed". How do I do this?
In fact 405 doesn't mean "post without data", you should answer 405 if you receive anything except 'POST' in HTTP method. This is done by a not very well-known decorator: from django.views.decorators.http import require_http_methods @require_http_methods('POST') def your_view(request): ... I think your app should react on an empty POST as it does on any invalid XML document. I mean just get request.raw_post_data and send it to a parser as you (presumably) do now. It doesn't matter if it has '' or 'some garbage' there. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---