由于某些原因,当使用http_method=GET而不是POST时,我无法读取请求参数。在
@endpoints.method(RequestMessage,
ResponseMessage,
name='get',
path='mypath',
http_method='GET')
def get_challenge(self, request):
# This is None in http_method=GET but works on POST
print request.my_message_field
我的信息类是这样的:
^{pr2}$我正在通过API浏览器测试API。知道我做错什么了吗?在
谢谢
参数应该显示为
my_message_field.id
和my_message_field.name
。在根本的区别在于
GET
没有有效载荷,POST
有。因此,参数名称空间必须是“flat”而不是嵌套JSON。为了适应这一点,我们把我前面提到的参数展平。在更新:
这一定是由于某些内容没有正确地移植到
devappserver
而引起的。我向endpoints.apiserving
添加了一个记录器,以确定从API前端传递到应用程序引擎后端的内容:生产中:
在
^{pr2}$devappserver2
:尝试通过解析时
这就是
api_server
所做的,这就是发生的事情生产中:
在
devappserver2
:相关问题 更多 >
编程相关推荐