Browse Source
♻️ Create `dependency-cache` dict in `solve_dependencies` only if `None` (don't re-create if empty) (#13689)
pull/13982/merge
Evgeny Bokshitsky
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
2 additions and
2 deletions
-
fastapi/dependencies/utils.py
|
|
@ -593,7 +593,8 @@ async def solve_dependencies( |
|
|
|
response = Response() |
|
|
|
del response.headers["content-length"] |
|
|
|
response.status_code = None # type: ignore |
|
|
|
dependency_cache = dependency_cache or {} |
|
|
|
if dependency_cache is None: |
|
|
|
dependency_cache = {} |
|
|
|
sub_dependant: Dependant |
|
|
|
for sub_dependant in dependant.dependencies: |
|
|
|
sub_dependant.call = cast(Callable[..., Any], sub_dependant.call) |
|
|
@ -630,7 +631,6 @@ async def solve_dependencies( |
|
|
|
embed_body_fields=embed_body_fields, |
|
|
|
) |
|
|
|
background_tasks = solved_result.background_tasks |
|
|
|
dependency_cache.update(solved_result.dependency_cache) |
|
|
|
if solved_result.errors: |
|
|
|
errors.extend(solved_result.errors) |
|
|
|
continue |
|
|
|