0
在我的谷歌App Engine应用程序,我有一个方法的处理程序PUT请求:我的self.error()在Google App Engine中被覆盖了吗?
def postMethod(self, arg):
response = do_backend_work(arg)
if response.field is None:
self.error(502)
self.response.out.write(json.dumps(
{'message': "you've been a bad boy!"}))
else:
<deal with well-formatted requests here>
.
.
.
然而,当我收到一个请求,其中response.field
为None
当我赶上了请求返回了200元。这个错误我插入raise Exception(str(self.response))
只是else
块作为一个全面的检查前,发现这个在日志中:
raise Exception(str(self.response))
Exception: 502 Bad Gateway
Content-Type: text/html; charset=utf-8
Cache-Control: no-cache
Content-Length: 63
{"message": "you've been a bad boy!"}
INFO 2012-08-15 23:25:12,239 dev_appserver.py:2952]
"PUT /url/resource HTTP/1.1" 200 -
是有什么我缺少有关App Engine是如何处理请求?