Closed alkimake closed 1 year ago
When resolving request level singletons, Request class from starlette can not be resolved
Request
As an example, editing the tests located at tests/integrations/fastapi_app/__init__.py as;
tests/integrations/fastapi_app/__init__.py
from contextlib import contextmanager from typing import Iterator -from fastapi import FastAPI +from fastapi import FastAPI, Request from lagom import Container, dependency_definition from lagom.integrations.fast_api import FastApiIntegration class Inner: - def __init__(self, msg=None): + def __init__(self, request: Request, msg=None): self.msg = msg + self.request = request
The resolution gives the following error;
lagom.exceptions.UnresolvableType: Unable to construct dependency of type Inner The constructor probably has some unre solvable dependencies
I will try to make a PR when i have time. But not promise :D
This will be available in version 2.3.0 which is currently being published/built: https://github.com/meadsteve/lagom/actions/runs/4344660974
When resolving request level singletons,
Request
class from starlette can not be resolvedAs an example, editing the tests located at
tests/integrations/fastapi_app/__init__.py
as;The resolution gives the following error;
I will try to make a PR when i have time. But not promise :D