diff --git a/CHANGES.rst b/CHANGES.rst index 4c471399..b02c1559 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -12,6 +12,8 @@ Unreleased - Parse path prefixes from server URLs and propagate them to all requests. +- Fixed compatibility with ``urllib3-future``. + 2025/01/30 2.0.0 ================ diff --git a/src/crate/client/http.py b/src/crate/client/http.py index 3d065f38..71f74c0c 100644 --- a/src/crate/client/http.py +++ b/src/crate/client/http.py @@ -187,7 +187,7 @@ def request( if "Content-Length" not in headers: length = super_len(data) if length is not None: - headers["Content-Length"] = length + headers["Content-Length"] = str(length) # Authentication credentials if username is not None: diff --git a/tests/client/test_http.py b/tests/client/test_http.py index 0292b661..d96ba765 100644 --- a/tests/client/test_http.py +++ b/tests/client/test_http.py @@ -192,7 +192,12 @@ def test_redirect_handling(): # - https://github.com/crate/crate-python/issues/179 # - https://github.com/crate/crate-python/issues/180 - assert client.server_pool["http://localhost:4201"].pool.conn_kw == { + # Remove some optional server pool parameters added by `urllib3-future`. + conn_kw = client.server_pool["http://localhost:4201"].pool.conn_kw + conn_kw.pop("keepalive_delay", None) + conn_kw.pop("resolver", None) + + assert conn_kw == { "socket_options": _get_socket_opts(keepalive=True) }