From 785b95f1b4d5894c6c97125ac146a87fe33871ee Mon Sep 17 00:00:00 2001 From: rijenkii Date: Thu, 28 Nov 2024 00:57:17 +0700 Subject: [PATCH 1/4] Bump starlette to >=0.41.3 Required for correct `HTTPException` types --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index edfa81522f..4059b46244 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ classifiers = [ "Topic :: Internet :: WWW/HTTP", ] dependencies = [ - "starlette>=0.40.0,<0.42.0", + "starlette>=0.41.3,<0.42.0", "pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0", "typing-extensions>=4.8.0", ] From 741b7dab6e81eea5115d5a7635b277d648c3b55d Mon Sep 17 00:00:00 2001 From: rijenkii Date: Thu, 28 Nov 2024 00:58:26 +0700 Subject: [PATCH 2/4] Fix `HTTPException.headers` type --- fastapi/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py index 44d4ada86d..492c68997d 100644 --- a/fastapi/exceptions.py +++ b/fastapi/exceptions.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, Optional, Sequence, Type, Union +from typing import Any, Mapping, Optional, Sequence, Type, Union from pydantic import BaseModel, create_model from starlette.exceptions import HTTPException as StarletteHTTPException @@ -54,7 +54,7 @@ class HTTPException(StarletteHTTPException): ), ] = None, headers: Annotated[ - Optional[Dict[str, str]], + Optional[Mapping[str, str]], Doc( """ Any headers to send to the client in the response. From d4f2888199b633c6f6aae563408f3de59a62c3f9 Mon Sep 17 00:00:00 2001 From: rijenkii Date: Mon, 6 Oct 2025 23:26:08 +0700 Subject: [PATCH 3/4] Revert starlette minimum version bump --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 2263a9224a..41ef1eb768 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ classifiers = [ "Topic :: Internet :: WWW/HTTP", ] dependencies = [ - "starlette>=0.41.3,<0.49.0", + "starlette>=0.40.0,<0.49.0", "pydantic>=1.7.4,!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,!=2.1.0,<3.0.0", "typing-extensions>=4.8.0", ] From 6238b5722ba734e383265a7f77d9f8acc0d07092 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 05:58:15 +0000 Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=8E=A8=20Auto=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastapi/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fastapi/exceptions.py b/fastapi/exceptions.py index dbb42ececf..3ec30fce99 100644 --- a/fastapi/exceptions.py +++ b/fastapi/exceptions.py @@ -1,5 +1,5 @@ -from collections.abc import Sequence -from typing import Annotated, Any, Mapping, Optional, TypedDict, Union +from collections.abc import Mapping, Sequence +from typing import Annotated, Any, Optional, TypedDict, Union from annotated_doc import Doc from pydantic import BaseModel, create_model