[FastAPI-16]Body参数校验
from fastapi import FastAPI,Body
app =FastAPI()
'''
使用方法同Path Query
'''
@app.post("/login")
def login(
name :str = Body(min_length=3),
age:int = Body(ge=18)
):
return {
"name":name,
"age":age
}