How to set a default value for FastAPI's Header?
I have a simple localised GET endpoint: @router.get("/codes", description="Get a list of codes data matching a query and locale") def get_codes_data( query: str = Query(default="", description="Search query"), accept_language: str = Header(default="de") ) -> CodesResponse: I would expect `Accept-Language` to be equal to `de` if I did not set a value. However, when a value is not provided, the value of `accept_language` is as follows: en-GB,en-US;q=0.9,en;q=0.8 When a value is provided, everything works as expected. I found a few issues on fastAPI's GitHub Issues that makes me think this is eit
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.