Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion django-stubs/http/request.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import sys
from collections.abc import Awaitable, Callable, Iterable, Iterator, Mapping, Sequence
from re import Pattern
from typing import Any, BinaryIO, Literal, NoReturn, Protocol, TypeAlias, TypeVar, overload, type_check_only
Expand All @@ -12,6 +13,11 @@ from django.utils.datastructures import CaseInsensitiveMapping, ImmutableList, M
from django.utils.functional import cached_property
from typing_extensions import Self, override

if sys.version_info >= (3, 14):
from io import Reader
else:
from typing_extensions import Reader

RAISE_ERROR: object
host_validation_re: Pattern[str]

Expand Down Expand Up @@ -42,7 +48,7 @@ class HttpHeaders(CaseInsensitiveMapping[str]):
@classmethod
def to_asgi_names(cls, headers: Mapping[str, Any]) -> dict[str, Any]: ...

class HttpRequest:
class HttpRequest(Reader):
GET: _ImmutableQueryDict
POST: _ImmutableQueryDict
COOKIES: dict[str, str]
Expand Down
8 changes: 7 additions & 1 deletion django-stubs/http/response.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import datetime
import sys
from collections.abc import AsyncIterable, AsyncIterator, Iterable, Iterator, Mapping
from http.cookies import SimpleCookie
from io import BytesIO
Expand All @@ -9,6 +10,11 @@ from django.utils.datastructures import CaseInsensitiveMapping, _PropertyDescrip
from django.utils.functional import _StrOrPromise, cached_property
from typing_extensions import override

if sys.version_info >= (3, 14):
from io import Writer
else:
from typing_extensions import Writer

class BadHeaderError(ValueError): ...

_Z = TypeVar("_Z")
Expand All @@ -21,7 +27,7 @@ class ResponseHeaders(CaseInsensitiveMapping[str]):
def pop(self, key: str, default: _Z = ...) -> _Z | tuple[str, str]: ...
def setdefault(self, key: str, value: str | bytes | int) -> None: ...

class HttpResponseBase:
class HttpResponseBase(Writer):
status_code: int
streaming: bool
cookies: SimpleCookie
Expand Down
Loading