mirror of
https://github.com/fastapi/fastapi.git
synced 2026-02-05 11:51:26 -05:00
Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com> Co-authored-by: Motov Yurii <109919500+YuriiMotov@users.noreply.github.com>
12 lines
369 B
Python
12 lines
369 B
Python
from fastapi import Header, HTTPException
|
|
|
|
|
|
async def get_token_header(x_token: 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")
|