proxy) sent a request that this server could not understand.“ 已处理"/>
“message“: “The browser (or proxy) sent a request that this server could not understand.“ 已处理
文章目录
- 1、项目场景:
- 2、问题描述
- 这是我练习的源码:
- 3、原因分析:
- 4、解决方案:
1、项目场景:
- 在学习flask-restful的restful的参数校验时,在postman进行接口测试时报错
- 错误:(服务器无法请求浏览器提供的数据)
2、问题描述
这是我练习的源码:
def post(self):# 步骤一:创建请求参数校验的对象rq=reqparse.RequestParser()#步骤二:定义参数的校验声明rq.add_argument('a',type=int,required=True,)#步骤三:启动校验rep=rq.parse_args()#步骤四:校验完成之后得到参数的值a=rep.areturn {'post':'hello xiaoyang','a':a}
#步骤三:把资源加载到api中,才能对外发布
api.add_resource(HelloResource,‘/hello’)
- postman请求
3.代码是没有问题的
3、原因分析:
1.自己网上查找了好多资料都没能解决问题
2. 后来经过老师的指导,发现是版本的问题
4、解决方案:
- 降低这些版本就可以了
# Flask==1.1.2
# Jinja2==3.0.1
# Werkzeug==2.0.1
# itsdangerous==2.0.1
# Flask-RESTful==0.3.8
- 到这里问题也就解决了
postman请求
更多推荐
“message“: “The browser (or proxy) sent a request that this server could not und
发布评论