From b0ef6934dc510919870fa57625acfd32c28653e4 Mon Sep 17 00:00:00 2001 From: Jim Bacon Date: Tue, 24 Sep 2024 17:36:51 +0000 Subject: [PATCH] Remove trailing / from endpoints Getting 307 redirect errors when calling from Drupal. --- app/user/user_routes.py | 4 ++-- app/validate/validate_routes.py | 3 +-- app/verify/verify_routes.py | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/user/user_routes.py b/app/user/user_routes.py index 19a42b7..0c0e467 100644 --- a/app/user/user_routes.py +++ b/app/user/user_routes.py @@ -41,7 +41,7 @@ class UserPatch(BaseModel): is_disabled: Optional[bool] = None -@router.get('/', summary="List users.", response_model=list[UserGet]) +@router.get('', summary="List users.", response_model=list[UserGet]) async def read_users(db: DbDependency): """Get all users.""" users = db.exec( @@ -68,7 +68,7 @@ async def read_user(db: DbDependency, username: str): return user -@router.post('/', summary="Create user.", response_model=UserGet) +@router.post('', summary="Create user.", response_model=UserGet) async def create_user(db: DbDependency, user_in: UserPost): """Create a new user.""" repo = UserRepo(db) diff --git a/app/validate/validate_routes.py b/app/validate/validate_routes.py index ded4254..6105f30 100644 --- a/app/validate/validate_routes.py +++ b/app/validate/validate_routes.py @@ -13,14 +13,13 @@ from .validate_models import Validate, Validated router = APIRouter( - prefix="/validate", tags=["Validate"], dependencies=[Depends(get_current_user)] ) @router.post( - "/", + "/validate", summary="Validate records.", response_model=list[Validated], response_model_exclude_none=True) diff --git a/app/verify/verify_routes.py b/app/verify/verify_routes.py index d46f2bf..dbbd667 100644 --- a/app/verify/verify_routes.py +++ b/app/verify/verify_routes.py @@ -14,14 +14,13 @@ router = APIRouter( - prefix="/verify", tags=["Verify"], dependencies=[Depends(get_current_user)] ) @router.post( - "/", + "/verify", summary="Verify records.", response_model=VerifiedPack, response_model_exclude_none=True)