Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change status code from 400 to 409 in docs_src /app_testing/ #11263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ async def create_item(item: Item, x_token: Annotated[str, Header()]):
if x_token != fake_secret_token:
raise HTTPException(status_code=400, detail="Invalid X-Token header")
if item.id in fake_db:
raise HTTPException(status_code=400, detail="Item already exists")
raise HTTPException(status_code=409, detail="Item already exists")
fake_db[item.id] = item
return item
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ def test_create_existing_item():
"description": "There goes my stealer",
},
)
assert response.status_code == 400
assert response.status_code == 409
assert response.json() == {"detail": "Item already exists"}
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an_py310/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ async def create_item(item: Item, x_token: Annotated[str, Header()]):
if x_token != fake_secret_token:
raise HTTPException(status_code=400, detail="Invalid X-Token header")
if item.id in fake_db:
raise HTTPException(status_code=400, detail="Item already exists")
raise HTTPException(status_code=409, detail="Item already exists")
fake_db[item.id] = item
return item
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an_py310/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ def test_create_existing_item():
"description": "There goes my stealer",
},
)
assert response.status_code == 400
assert response.status_code == 409
assert response.json() == {"detail": "Item already exists"}
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an_py39/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ async def create_item(item: Item, x_token: Annotated[str, Header()]):
if x_token != fake_secret_token:
raise HTTPException(status_code=400, detail="Invalid X-Token header")
if item.id in fake_db:
raise HTTPException(status_code=400, detail="Item already exists")
raise HTTPException(status_code=409, detail="Item already exists")
fake_db[item.id] = item
return item
2 changes: 1 addition & 1 deletion docs_src/app_testing/app_b_an_py39/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ def test_create_existing_item():
"description": "There goes my stealer",
},
)
assert response.status_code == 400
assert response.status_code == 409
assert response.json() == {"detail": "Item already exists"}