We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
我封装了一个类,用来获取json数据,然后将这个类注入到app中。结果在获取的json是None。
I encapsulated a class to retrieve JSON data and then injected this class into the app. The result is that the obtained JSON is None.
# class class JSonData: data = None def __init__(self, data: Optional[dict] = None): self.data = data @classmethod def get_json_data(cls, request: Request): try: data = request.json or {} except: data = {} return cls(data) # ----------- # 获取请求体json数据 app.ext.add_dependency(JSonData, JSonData.get_json_data)
request.json=None
Sanic CLI
Windows
23.6.0
我在视图函数中打印request.json,结果就是有数据的, 应该是时间问题
I print request.json in the view function, and the result is that there is data,
It should be a matter of time
The text was updated successfully, but these errors were encountered:
我知道了,需要等待。
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue for this?
Describe the bug
我封装了一个类,用来获取json数据,然后将这个类注入到app中。结果在获取的json是None。
I encapsulated a class to retrieve JSON data and then injected this class into the app. The result is that the obtained JSON is None.
Code snippet
Expected Behavior
request.json=None
How do you run Sanic?
Sanic CLI
Operating System
Windows
Sanic Version
23.6.0
Additional context
我在视图函数中打印request.json,结果就是有数据的,
应该是时间问题
I print request.json in the view function, and the result is that there is data,
It should be a matter of time
The text was updated successfully, but these errors were encountered: