在我的 Google App Engine 应用程序中,我有一个带有 PUT 请求方法的处理程序:
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 如何处理请求,我有什么遗漏吗?