Coverage for docs_src / dependencies / tutorial011_py310.py: 100%
13 statements
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
« prev ^ index » next coverage.py v7.13.3, created at 2026-04-06 01:24 +0000
1from fastapi import Depends, FastAPI 1abcdefg
3app = FastAPI() 1abcdefg
6class FixedContentQueryChecker: 1abcdefg
7 def __init__(self, fixed_content: str): 1abcdefg
8 self.fixed_content = fixed_content 1abcdefg
10 def __call__(self, q: str = ""): 1abcdefg
11 if q: 1hijklmnopqr
12 return self.fixed_content in q 1ijslnoqr
13 return False 1hkmp
16checker = FixedContentQueryChecker("bar") 1abcdefg
19@app.get("/query-checker/") 1abcdefg
20async def read_query_check(fixed_content_included: bool = Depends(checker)): 1abcdefg
21 return {"fixed_content_in_query": fixed_content_included} 1hijklmnopqr