Skip to content

Commit

Permalink
Returen 201 status code correctly (#410)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnusunny authored Mar 11, 2024
1 parent dc1066f commit ac6fff3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/fastapi-background-tasks/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def mock_task(seconds):
print("in mock_task method \n")
time.sleep(seconds)

@app.post("/tasks")
@app.post("/tasks", status_code=201)
async def create_task():
print("in create_task method \n")
background_task.add_task(mock_task, 2)
background_task.add_task(mock_task, 3)
return (201, "task created")
return "task created"

@app.get("/")
async def root():
Expand Down

0 comments on commit ac6fff3

Please sign in to comment.