[FastAPI-19]响应状态码

from fastapi import FastAPI,status
from pydantic import BaseModel

app = FastAPI()

'''
响应状态代码 status
'''

class User(BaseModel):
    username : str
    password : str

@app.post("/login",status_code=status.HTTP_200_OK)
def login(user : User):
    return {
        "username":user.username,
        "password":user.password
    }
posted @ 2023-03-24 11:30  LeoShi2020  阅读(19)  评论(0编辑  收藏  举报