赞
踩
响应状态码和快捷属性
"""Response Status Code 响应状态码"""
from fastapi import APIRouter, status, Form, File, UploadFile, HTTPException
@app02.post("/status_code", status_code=200)
async def status_code():
return {"status_code": 200}
@app02.post("/status_attribute", status_code=status.HTTP_200_OK)
async def status_attribute():
print(type(status.HTTP_200_OK))
return {"status_code": status.HTTP_200_OK}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。