mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-06 08:06:51 -04:00
14 lines
409 B
Python
14 lines
409 B
Python
from typing import Annotated
|
|
|
|
from fastapi import Header, HTTPException
|
|
|
|
|
|
async def get_token_header(x_token: Annotated[str, Header()]):
|
|
if x_token != "fake-super-secret-token":
|
|
raise HTTPException(status_code=400, detail="X-Token header invalid")
|
|
|
|
|
|
async def get_query_token(token: str):
|
|
if token != "jessica":
|
|
raise HTTPException(status_code=400, detail="No Jessica token provided")
|