1. Jesper Noehr
  2. django-piston
  3. Issues
Issue #63 resolved

HEAD on a resource errors/500s

Steve Jalim
created an issue

I have a resource I can access fine via GET, but when I try to HEAD it via curl i get a 500 error

{{{

!python

SteveBookPro:~ steve$ curl -I "http://127.0.0.1:8000/foos/" -X HEAD

HTTP/1.0 500 INTERNAL SERVER ERROR Date: Tue, 18 Aug 2009 08:37:03 GMT Server: WSGIServer/0.1 Python/2.5.1 Content-Type: text/html }}}

While using the Django 1.1 TestClient raises the following exception:

{{{

!python

Traceback (most recent call last): File "/usr/local/django/lv/lv_core/apps/apihandler/tests/myapphandler_tests.py", line 38, in test_head_request r = c.head('/foos/') File "/Users/steve/.virtualenvs/lv/lib/python2.5/site-packages/django/test/client.py", line 332, in head response = self.request(r) File "/Users/steve/.virtualenvs/lv/lib/python2.5/site-packages/django/core/handlers/base.py", line 92, in get_response response = callback(request, *callback_args, callback_kwargs) File "/Users/steve/.virtualenvs/lv/lib/python2.5/site-packages/django/views/decorators/vary.py", line 21, in inner_func response = func(args, *kwargs) File "/usr/local/django/lv/lv_core/lib/piston/resource.py", line 97, in call meth = getattr(handler, self.callmap.get(rm), None) TypeError: getattr(): attribute name must be string }}}

Given that the GET works fine, I'm wondering if this is a bug. I'm using the BaseHandler class for my resources, but currently have no authentication in play, in case that is an influencing factor. Also, I don't have a content_size (yet) defined.

Any advice appreciated!

Cheers Steve

Comments (5)

  1. Steve Jalim reporter

    Hi Jespern

    Thanks for the rapid reply.

    I'm a little new to HEAD, but thought I'd be getting back a 200 with the same headers as GET, just without the entity body.

    Cheers Steve

  2. Steve Jalim reporter

    Ah, no worries, that's fine -- thanks for clearing it up!

    (in other news, if you have two mins to weigh in on my XML questions in the google group, that'd be really really handy)

    Cheers Steve

  3. Log in to comment