Coverage for docs_src/bigger_applications/app_an_py39/dependencies.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.6.1, created at 2024-08-08 03:53 +0000

1from typing import Annotated 1abcd

2 

3from fastapi import Header, HTTPException 1abcd

4 

5 

6async def get_token_header(x_token: Annotated[str, Header()]): 1abcd

7 if x_token != "fake-super-secret-token": 1abcd

8 raise HTTPException(status_code=400, detail="X-Token header invalid") 1abcd

9 

10 

11async def get_query_token(token: str): 1abcd

12 if token != "jessica": 1abcd

13 raise HTTPException(status_code=400, detail="No Jessica token provided") 1abcd