Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

raise BadRequest("Failed to decode JSON object: {0}".format(e)) #85

Closed
DonkeXu opened this issue May 7, 2020 · 1 comment
Closed

raise BadRequest("Failed to decode JSON object: {0}".format(e)) #85

DonkeXu opened this issue May 7, 2020 · 1 comment

Comments

@DonkeXu
Copy link

DonkeXu commented May 7, 2020

req_body = request.get_json() if request.get_json() else {}
这里报错(我是在小程序端调用)
raise BadRequest("Failed to decode JSON object: {0}".format(e))
那行加了try···except···后log输出
"path": {}, "query": {}, "body": {}
可能是request没有获得参数?

@Allen7D
Copy link
Owner

Allen7D commented May 7, 2020

apply_request_log方式必须是debug模式下运行,线上直接使用会报错

请修改app/config/secure.py中配置项
DEBUG = False

在app/init.py就能正常运行
if app.config['DEBUG']:
apply_request_log(app) # 打印请求日志

@DonkeXu DonkeXu closed this as completed May 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants