Skip to content

[PR #10959/cc234c6d backport][3.12] Change ClientSession middlewares default to be an empty tuple #10960

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

Merged
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
1 change: 1 addition & 0 deletions CHANGES/10959.feature.rst
2 changes: 1 addition & 1 deletion aiohttp/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def __init__(
max_line_size: int = 8190,
max_field_size: int = 8190,
fallback_charset_resolver: _CharsetResolver = lambda r, b: "utf-8",
middlewares: Optional[Sequence[ClientMiddlewareType]] = None,
middlewares: Sequence[ClientMiddlewareType] = (),
) -> None:
# We initialise _connector to None immediately, as it's referenced in __del__()
# and could cause issues if an exception occurs during initialisation.
Expand Down
4 changes: 2 additions & 2 deletions docs/client_reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The client session supports the context manager protocol for self closing.
trust_env=False, \
requote_redirect_url=True, \
trace_configs=None, \
middlewares=None, \
middlewares=(), \
read_bufsize=2**16, \
max_line_size=8190, \
max_field_size=8190, \
Expand Down Expand Up @@ -232,7 +232,7 @@ The client session supports the context manager protocol for self closing.

:param middlewares: A sequence of middleware instances to apply to all session requests.
Each middleware must match the :type:`ClientMiddlewareType` signature.
``None`` (default) is used when no middleware is needed.
``()`` (empty tuple, default) is used when no middleware is needed.
See :ref:`aiohttp-client-middleware` for more information.

.. versionadded:: 3.12
Expand Down
Loading