Skip to content

Commit ac6fff3

Browse files
authored
Returen 201 status code correctly (#410)
1 parent dc1066f commit ac6fff3

File tree

1 file changed

+2
-2
lines changed
  • examples/fastapi-background-tasks/app

1 file changed

+2
-2
lines changed

examples/fastapi-background-tasks/app/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ def mock_task(seconds):
1919
print("in mock_task method \n")
2020
time.sleep(seconds)
2121

22-
@app.post("/tasks")
22+
@app.post("/tasks", status_code=201)
2323
async def create_task():
2424
print("in create_task method \n")
2525
background_task.add_task(mock_task, 2)
2626
background_task.add_task(mock_task, 3)
27-
return (201, "task created")
27+
return "task created"
2828

2929
@app.get("/")
3030
async def root():

0 commit comments

Comments
 (0)