diff --git a/endpoints/users.get.py b/endpoints/users.get.py index b3e30c5..0a62914 100644 --- a/endpoints/users.get.py +++ b/endpoints/users.get.py @@ -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 \ No newline at end of file + } \ No newline at end of file