On Jul 2, 7:55 pm, Andrew Fong <fongand...@gmail.com> wrote:
> How exactly should I handle a HEAD request in Django?
>
> So ... assuming my view looks like this...
>
> def handle_request(request):
>     if request.method == 'POST': return do_post(request)
>     elif request.method == 'GET': return do_get(request)
>     elif request.method == 'HEAD': return do_head(request)
>
> ... what should the do_head method return?  The W3 standard says "The
> HEAD method is identical to GET except that the server MUST NOT return
> a message-body in the response".
>
> How exactly do I not return a message body though? Do I just return
> None? Do I return the response I would for a GET and then modify it
> somehow?
>
> Thanks in advance!
>
> -- Andrew

You can just return a blank instance of HttpResponse. You can set
headers on it if you want but you don't have to pass in any content.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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 
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