Using latest release 1.3.x.
@request.restful()
def rest():
response.view = 'generic.json'
def GET(*args, **vars):
...
def POST(*args, **vars):
...
def PUT(*args, **vars):
...
def DELETE(*args, **vars):
if 'delete' in args[0]:
return delete(api_key=vars['api_key'],
item_id=vars['item_id']
)
raise HTTP(400)
return locals()
def test_rest(request_type, api_func, vars):
import httplib
import urllib
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection(yak_globs.HOST)
conn.request(request_type,
'/api/rest/%s' % api_func,
urllib.urlencode(vars),
headers,
)
response = conn.getresponse()
return response.read()
def test_rest_delete():
vars = dict(
api_key='some string',
item_id=439,
)
return test_rest('DELETE', 'delete', vars)
Problem is, vars for DELETE gets passed as empty dict {}. If instead of
'DELETE' I reference 'POST', the vars get passed correctly. Am I doing
something wrong, or is it a bug?
--