diff --git a/litestar/datastructures/headers.py b/litestar/datastructures/headers.py index 410952467a..d31c602981 100644 --- a/litestar/datastructures/headers.py +++ b/litestar/datastructures/headers.py @@ -12,6 +12,7 @@ Optional, Union, cast, + overload, ) import msgspec @@ -440,6 +441,12 @@ def __getitem__(self, key: int) -> str: def __iter__(self) -> Iterator[str]: return map(str, self._accepted_types) + @overload + def best_match(self, provided_types: list[str], default: None = None) -> Optional[str]: ... + + @overload + def best_match(self, provided_types: list[str], default: str) -> str: ... + def best_match(self, provided_types: list[str], default: Optional[str] = None) -> Optional[str]: """Find the best matching media type for the request.