You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@router.post("/employees/create")
def create_employee(request, payload: EmployeeIn):
employee = Employee.objects.create(**payload.dict())
return standard_response(data=employee.id)
When I requested the interface "/employees/create" using Postman, it prompted "method not allowed". I started debugging the code and found that in this case, the post interface would recognize "/create" as "{employee_id}" in the get interface, resulting in this error prompt
Although this bug can be easily avoided, I hope to receive your advice. I am a Python beginner, haha
The text was updated successfully, but these errors were encountered:
Describe the bug
A clear and concise description of what the bug is.
Versions (please complete the following information):
hi,vitalik
Thank you very much for this great project
this is my code in api.py
@router.get("/employees/{employee_id}", response=EmployeeOut, description="根据id获取员工信息")
def get_employee_by_id(request, employee_id: int):
employee_instance = get_object_or_404(Employee, id=employee_id)
return standard_response(data=employee_instance)
@router.post("/employees/create")
def create_employee(request, payload: EmployeeIn):
employee = Employee.objects.create(**payload.dict())
return standard_response(data=employee.id)
When I requested the interface "/employees/create" using Postman, it prompted "method not allowed". I started debugging the code and found that in this case, the post interface would recognize "/create" as "{employee_id}" in the get interface, resulting in this error prompt
Although this bug can be easily avoided, I hope to receive your advice. I am a Python beginner, haha
The text was updated successfully, but these errors were encountered: