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()
|
||||
|
||||
towns = [
|
||||
towns_in_arizona = [
|
||||
"Phoenix",
|
||||
"Tucson",
|
||||
"Mesa",
|
||||
@ -15,14 +15,14 @@ towns = [
|
||||
"Surprise"
|
||||
]
|
||||
|
||||
@router.post("/open")
|
||||
async def get_arizona_towns():
|
||||
"""endpoint that returns list of town in arizona"""
|
||||
@router.post("/open", summary="Returns list of towns in Arizona")
|
||||
async def get_towns_in_arizona():
|
||||
"""Returns list of towns in Arizona"""
|
||||
if request.method != "POST":
|
||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||
raise HTTPException(status_code=405, detail="Method not allowed")
|
||||
|
||||
return {
|
||||
"method": "POST",
|
||||
"_verb": "post",
|
||||
"towns": towns
|
||||
"towns": towns_in_arizona
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user