Update code in endpoints/open.post.py
This commit is contained in:
parent
2d730b21a0
commit
13b547dd1d
@ -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
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user