Relative Content

Tag Archive for pythonrestfastapirestful-url

Does it make sense to specify the user id in the path, if I already get it through the JWT token?

@router.get(“/{id}/files”) async def get_user_files( id: int, user: UserS = Depends(get_current_user), user_service: UserService = Depends(user_service), ) -> UserFiles | None: if id == user.id: user_files = await user_service.get_files(user.id) return user_files In this example code, I expect that the user will pass the id of the person he wants to receive, but does this make sense if […]