Update code in endpoints/users.get.py
This commit is contained in:
parent
2e12c7c759
commit
b50203da17
@ -3,13 +3,15 @@ from fastapi import APIRouter, HTTPException
|
||||
users = [
|
||||
{
|
||||
"id": "1",
|
||||
"name": "John Doe",
|
||||
"country": "Nigeria"
|
||||
"username": "johndoe",
|
||||
"email": "john@example.com",
|
||||
"country": "France"
|
||||
},
|
||||
{
|
||||
"id": "2",
|
||||
"name": "Jane Smith",
|
||||
"country": "South Africa"
|
||||
"username": "janedoe",
|
||||
"email": "jane@example.com",
|
||||
"country": "Germany"
|
||||
}
|
||||
]
|
||||
|
||||
@ -17,14 +19,12 @@ router = APIRouter()
|
||||
|
||||
@router.get("/users")
|
||||
async def get_users():
|
||||
"""Fetches list of users"""
|
||||
response = {
|
||||
"""Fetch list of users"""
|
||||
if request.method != "GET":
|
||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||
|
||||
return {
|
||||
"method": "GET",
|
||||
"_verb": "get",
|
||||
"users": users
|
||||
}
|
||||
|
||||
if request.method != "GET":
|
||||
raise HTTPException(status_code=405, detail="Method Not Allowed")
|
||||
|
||||
return response
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user