summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docker/api/container.py5
-rw-r--r--tests/unit/api_container_test.py11
2 files changed, 14 insertions, 2 deletions
diff --git a/docker/api/container.py b/docker/api/container.py
index fef7603..40607e7 100644
--- a/docker/api/container.py
+++ b/docker/api/container.py
@@ -1164,8 +1164,9 @@ class ContainerApiMixin:
'one_shot is only available in conjunction with '
'stream=False'
)
- return self._stream_helper(self._get(url, params=params),
- decode=decode)
+ return self._stream_helper(
+ self._get(url, stream=True, params=params), decode=decode
+ )
else:
if decode:
raise errors.InvalidArgument(
diff --git a/tests/unit/api_container_test.py b/tests/unit/api_container_test.py
index c605da3..c4e2250 100644
--- a/tests/unit/api_container_test.py
+++ b/tests/unit/api_container_test.py
@@ -1528,10 +1528,21 @@ class ContainerTest(BaseAPIClientTest):
fake_request.assert_called_with(
'GET',
url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats',
+ stream=True,
timeout=60,
params={'stream': True}
)
+ def test_container_stats_without_streaming(self):
+ self.client.stats(fake_api.FAKE_CONTAINER_ID, stream=False)
+
+ fake_request.assert_called_with(
+ 'GET',
+ url_prefix + 'containers/' + fake_api.FAKE_CONTAINER_ID + '/stats',
+ timeout=60,
+ params={'stream': False}
+ )
+
def test_container_stats_with_one_shot(self):
self.client.stats(
fake_api.FAKE_CONTAINER_ID, stream=False, one_shot=True)