-
First Check
Commit to Help
Example Codetime_middleware.py:
class TimeMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request, call_next):
print(f"{request.client.host}")
-------------
test.py:
client = TestClient(app)
def test_ping():
response = client.get("/v1.0/ping")
assert response.status_code == 200
------------
main.py:
app= FastAPI(...)
app.add_middleware(paa.TimeMiddleware)DescriptionThe problem only occurs in v0.109.0 when run tests. Operating SystemLinux Operating System DetailsNo response FastAPI Version0.109.0 Pydantic Version2.5.3 Python Version3.8.10 Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 11 replies
-
|
The code is an extract of mine. |
Beta Was this translation helpful? Give feedback.
-
|
I have the same problem. |
Beta Was this translation helpful? Give feedback.
-
|
I do too, I suspect it's related to this change in Starlette mentioned here. |
Beta Was this translation helpful? Give feedback.
-
|
it is indeed. I "solved" it by checking if |
Beta Was this translation helpful? Give feedback.
-
|
When fixing the ReDoS attack on CVE-2024-24762, I encountered the same issue. |
Beta Was this translation helpful? Give feedback.
-
|
I am having the same issues when running pytest. It only works with fastapi versions older than 0.105.0. Has anyone here found a solution? |
Beta Was this translation helpful? Give feedback.
-
|
I was able to resolve the issue by updating the Starlette framework to version 0.37.2 |
Beta Was this translation helpful? Give feedback.
-
|
This was updated in Starlette, and FastAPI 0.110.1 upgraded Starlette, maybe that fixes the problem, could you try that? 🤓 |
Beta Was this translation helpful? Give feedback.
This was updated in Starlette, and FastAPI 0.110.1 upgraded Starlette, maybe that fixes the problem, could you try that? 🤓