I'm trying to use the header: X-HTTP-Method-Override: PATCH
(as stated in the Tastypie Docs , just search for X-HTTP-Method-Override
there) so that I can simulate a PATCH
(Not supported in heroku) when using tastypie in heroku.
I'm trying out this curl request
curl --dump-header - -H "Content-Type: application/json" -H "X-HTTP-Method-Override: PATCH" -H "Authorization: ApiKey admin:TheApiKey" -X POST --data '{"token": "test1234"}' http://staging.myserver.com/api/v1/devices/449/
Locally it works perfectly well, but when I try it on my heroku-hosted app, I get:
HTTP/1.1 501 NOT IMPLEMENTED
Content-Type: text/html; charset=utf-8
Date: Fri, 25 Jan 2013 17:45:11 GMT
Server: gunicorn/0.15.0
Content-Length: 0
Connection: keep-alive
What could be the issue here?
The 501 error has nothing to do with Heroku.
I believe it to be the setup of your Resource.
There is a bit of a gotcha with TastyPie, and I would refer to the following line from the documentation:
"For PATCH to work, you must have put in your detail_allowed_methods setting."
i.e.
detail_allowed_methods = ['get', 'post', 'put', 'delete', 'patch']