FASTAPI:从 post 请求读取时 Body(...) 中的`(..)` 是什么?
FASTAPI: what is`(..)` in the Body(...) while reading from a post request?
我正在尝试使用 FastAPI 从我的 POST 请求中读取正文。
但是我无法理解 Body 函数的 (...)
参数
这是我的代码:
@app.post('/createPosts')
def create_post(payload: dict = Body(...)):
print(payload)
return {'message': 'succesfully created post'}
可能是重复的问题。这是另一个:
What does the Ellipsis object do?
它是 Python 的一部分,不是 FastAPI
我正在尝试使用 FastAPI 从我的 POST 请求中读取正文。
但是我无法理解 Body 函数的 (...)
参数
这是我的代码:
@app.post('/createPosts')
def create_post(payload: dict = Body(...)):
print(payload)
return {'message': 'succesfully created post'}
可能是重复的问题。这是另一个:
What does the Ellipsis object do?
它是 Python 的一部分,不是 FastAPI