Skip to content

Change test Client headers parameter to Mapping[str, str] #1534

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
42 changes: 21 additions & 21 deletions django-stubs/test/client.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class _RequestFactory(Generic[_T]):
cookies: SimpleCookie
errors: BytesIO
def __init__(
self, *, json_encoder: type[JSONEncoder] = ..., headers: Mapping[str, Any] | None = ..., **defaults: Any
self, *, json_encoder: type[JSONEncoder] = ..., headers: Mapping[str, str] | None = ..., **defaults: Any
) -> None: ...
def request(self, **request: Any) -> _T: ...
def get(
Expand All @@ -81,7 +81,7 @@ class _RequestFactory(Generic[_T]):
data: _GetDataType = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def post(
Expand All @@ -91,21 +91,21 @@ class _RequestFactory(Generic[_T]):
content_type: str = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def head(
self, path: str, data: Any = ..., secure: bool = ..., *, headers: Mapping[str, Any] | None = ..., **extra: Any
self, path: str, data: Any = ..., secure: bool = ..., *, headers: Mapping[str, str] | None = ..., **extra: Any
) -> _T: ...
def trace(self, path: str, secure: bool = ..., *, headers: Mapping[str, Any] | None = ..., **extra: Any) -> _T: ...
def trace(self, path: str, secure: bool = ..., *, headers: Mapping[str, str] | None = ..., **extra: Any) -> _T: ...
def options(
self,
path: str,
data: dict[str, str] | str = ...,
content_type: str = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def put(
Expand All @@ -115,7 +115,7 @@ class _RequestFactory(Generic[_T]):
content_type: str = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def patch(
Expand All @@ -125,7 +125,7 @@ class _RequestFactory(Generic[_T]):
content_type: str = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def delete(
Expand All @@ -135,7 +135,7 @@ class _RequestFactory(Generic[_T]):
content_type: str = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...
def generic(
Expand All @@ -146,7 +146,7 @@ class _RequestFactory(Generic[_T]):
content_type: str | None = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _T: ...

Expand Down Expand Up @@ -193,13 +193,13 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
raise_request_exception: bool
exc_info: tuple[type[BaseException], BaseException, TracebackType] | None
extra: dict[str, Any] | None
headers: dict[str, Any]
headers: Mapping[str, str] | None
def __init__(
self,
enforce_csrf_checks: bool = ...,
raise_request_exception: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**defaults: Any,
) -> None: ...
def request(self, **request: Any) -> _MonkeyPatchedWSGIResponse: ...
Expand All @@ -210,7 +210,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def post( # type: ignore[override]
Expand All @@ -221,7 +221,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def head( # type: ignore[override]
Expand All @@ -231,7 +231,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def options( # type: ignore[override]
Expand All @@ -242,7 +242,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def put( # type: ignore[override]
Expand All @@ -253,7 +253,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def patch( # type: ignore[override]
Expand All @@ -264,7 +264,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def delete( # type: ignore[override]
Expand All @@ -275,7 +275,7 @@ class Client(ClientMixin, _RequestFactory[_MonkeyPatchedWSGIResponse]):
follow: bool = ...,
secure: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**extra: Any,
) -> _MonkeyPatchedWSGIResponse: ...
def trace( # type: ignore[override]
Expand All @@ -294,13 +294,13 @@ class AsyncClient(ClientMixin, _AsyncRequestFactory[Awaitable[_MonkeyPatchedASGI
raise_request_exception: bool
exc_info: Any
extra: dict[str, Any] | None
headers: dict[str, Any]
headers: Mapping[str, str] | None
def __init__(
self,
enforce_csrf_checks: bool = ...,
raise_request_exception: bool = ...,
*,
headers: Mapping[str, Any] | None = ...,
headers: Mapping[str, str] | None = ...,
**defaults: Any,
) -> None: ...
async def request(self, **request: Any) -> _MonkeyPatchedASGIResponse: ...