Update code in endpoints/open.post.py

This commit is contained in:
Backend IM Bot 2025-03-23 15:59:47 +01:00
parent 2d730b21a0
commit 13b547dd1d

View File

@ -2,7 +2,7 @@ from fastapi import APIRouter, HTTPException
router = APIRouter() router = APIRouter()
towns = [ towns_in_arizona = [
"Phoenix", "Phoenix",
"Tucson", "Tucson",
"Mesa", "Mesa",
@ -15,14 +15,14 @@ towns = [
"Surprise" "Surprise"
] ]
@router.post("/open") @router.post("/open", summary="Returns list of towns in Arizona")
async def get_arizona_towns(): async def get_towns_in_arizona():
"""endpoint that returns list of town in arizona""" """Returns list of towns in Arizona"""
if request.method != "POST": if request.method != "POST":
raise HTTPException(status_code=405, detail="Method Not Allowed") raise HTTPException(status_code=405, detail="Method not allowed")
return { return {
"method": "POST", "method": "POST",
"_verb": "post", "_verb": "post",
"towns": towns "towns": towns_in_arizona
} }