diff --git a/docker/client.py b/docker/client.py index 34f8e990..0e00768d 100644 --- a/docker/client.py +++ b/docker/client.py @@ -567,14 +567,11 @@ class Client(requests.Session): raise errors.InvalidVersion('Exec is not supported in API < 1.15') if isinstance(exec_id, dict): exec_id = exec_id.get('Id') - data = { - 'h': height, - 'w': width - } - res = self._post_json( - self._url('/exec/{0}/resize'.format(exec_id)), data - ) - res.raise_for_status() + + params = {'h': height, 'w': width} + url = self._url("/exec/{0}/resize".format(exec_id)) + res = self._post(url, params=params) + self._raise_for_status(res) def exec_start(self, exec_id, detach=False, tty=False, stream=False): if utils.compare_version('1.15', self._version) < 0: diff --git a/tests/test.py b/tests/test.py index 5d31958f..efcb37c3 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1662,22 +1662,10 @@ class DockerClientTest(Cleanup, base.BaseTestCase): except Exception as e: self.fail('Command should not raise exception: {0}'.format(e)) - args = fake_request.call_args - self.assertEqual( - args[0][0], url_prefix + 'exec/{0}/resize'.format( - fake_api.FAKE_EXEC_ID - ) - ) - - self.assertEqual( - json.loads(args[1]['data']), { - 'h': 20, - 'w': 60, - } - ) - - self.assertEqual( - args[1]['headers'], {'Content-Type': 'application/json'} + fake_request.assert_called_with( + url_prefix + 'exec/{0}/resize'.format(fake_api.FAKE_EXEC_ID), + params={'h': 20, 'w': 60}, + timeout=DEFAULT_TIMEOUT_SECONDS ) def test_pause_container(self):