Update code in endpoints/kenya.get.py

This commit is contained in:
Backend IM Bot 2025-03-23 08:55:35 +01:00
parent a53339d61c
commit 7adbf7ba6e

View File

@ -6,19 +6,22 @@ west_nigeria_states = [
"Ekiti", "Ekiti",
"Lagos", "Lagos",
"Ogun", "Ogun",
"Ondo", "Ondo",
"Osun", "Osun",
"Oyo" "Oyo"
] ]
@router.get("/kenya", response_model=dict) @router.get("/kenya")
async def get_west_nigeria_states(): async def get_west_nigeria_states():
"""Returns list of states in west Nigeria""" """Returns list of states in west Nigeria"""
if request.method != "GET": if request.method != "GET":
raise HTTPException(status_code=405, detail="Method Not Allowed") raise HTTPException(status_code=405, detail={
"message": "Method Not Allowed",
"method": request.method,
"_verb": "get"
})
return { return {
"method": "GET", "method": "GET",
"_verb": "get", "states": west_nigeria_states
"west_nigeria_states": west_nigeria_states
} }