I am using webpy 0.34, python 2.6.6. I also use mimerender. I am trying to include the length of the content in my HTTP response, but for some reason the header is being deleted. I say that delete, because I can create custom headers just fine, and I can see these headers on the client. But when I try to set the length of the content, the header never makes it to the client. I tried to include the header in the web.created object (as shown), and I also tried using
web.header('Content-Length', len(data))
What am I doing wrong and / or do not understand how this code works?
render_json = lambda **args: json.JSONEncoder().encode(args) class MyHandler: @mimerender( default = 'json', json = render_json, ) def POST(self): data = "abcd" raise web.created(data, headers={'Content-Length': len(data)})
python web.py web-services
ryanday
source share