diff --git a/CHANGES/10959.feature.rst b/CHANGES/10959.feature.rst new file mode 120000 index 00000000000..b565aa68ee0 --- /dev/null +++ b/CHANGES/10959.feature.rst @@ -0,0 +1 @@ +9732.feature.rst \ No newline at end of file diff --git a/aiohttp/client.py b/aiohttp/client.py index bea1c6f61e7..811c8f97588 100644 --- a/aiohttp/client.py +++ b/aiohttp/client.py @@ -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. diff --git a/docs/client_reference.rst b/docs/client_reference.rst index 97933ada1ed..cd825b403a0 100644 --- a/docs/client_reference.rst +++ b/docs/client_reference.rst @@ -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, \ @@ -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