How to require request headers or fail (migration from FastAPI) #2286
-
I'm trying to migrate from FastAPI to LiteStar and have not found a way to migrate the request header requirements @app.post("/test")
async def post_test(
data: MyPydanticModel,
x_ms_client_principal_id: Annotated[str, Header()],
x_ms_client_principal_name: Annotated[str, Header()],
request: Request,
):
... What the above code does is to check if the request header contains the two parameters How do I do that in LiteStar? |
Beta Was this translation helpful? Give feedback.
Answered by
Alc-Alc
Sep 7, 2023
Replies: 1 comment 1 reply
-
Does this do what you want?
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
danielniccoli
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Does this do what you want?