async def post( self, model: UserModel = Body.i(), other_model: UserOtherModel = Body.i(), ) -> response.HTTPResponse: return_dict = model.dict() return_dict.update(other_model.dict()) return_dict.update({"user_agent": self.user_agent}) return response.json({"code": 0, "msg": "", "data": return_dict})
def post( self, model: UserModel = Body.i(), other_model: UserOtherModel = Body.i(), ) -> dict: return_dict = model.dict() return_dict.update(other_model.dict()) return_dict.update({"user_agent": self.user_agent}) return {"code": 0, "msg": "", "data": return_dict}
async def test_raise_tip( model: UserModel = Body.i(), other_model: UserOtherModel = Body.i(), content_type: str = Header.i(description="content-type"), ) -> response.HTTPResponse: """Test Method: error tip""" return_dict = model.dict() return_dict.update(other_model.dict()) return_dict.update({"content_type": content_type}) return response.json({"code": 0, "msg": "", "data": return_dict})
async def test_post( model: UserModel = Body.i(), other_model: UserOtherModel = Body.i(), sex: SexEnum = Body.i(description="sex"), content_type: str = Header.i(alias="Content-Type", description="content-type"), ) -> JSONResponse: """Test Method:Post Pydantic Model""" return_dict = model.dict() return_dict["sex"] = sex.value return_dict.update(other_model.dict()) return_dict.update({"content_type": content_type}) return JSONResponse({"code": 0, "msg": "", "data": return_dict})
def test_raise_tip( model: UserModel = Body.i(), other_model: UserOtherModel = Body.i(), content__type: str = Header.i( description="Content-Type" ), # in flask, Content-Type's key is content_type ) -> dict: """Test Method: error tip""" return_dict = model.dict() return_dict.update(other_model.dict()) return_dict.update({"content_type": content__type}) return {"code": 0, "msg": "", "data": return_dict}