Kaydet (Commit) 5464cf2b authored tarafından David Gageot's avatar David Gageot Kaydeden (comit) Aanand Prasad

Add hijack hints for non-detached exec api calls

Signed-off-by: 's avatarDavid Gageot <david@gageot.net>
üst 6dec639a
......@@ -66,8 +66,16 @@ class ExecApiMixin(object):
'Detach': detach
}
headers = {} if detach else {
'Connection': 'Upgrade',
'Upgrade': 'tcp'
}
res = self._post_json(
self._url('/exec/{0}/start', exec_id), data=data, stream=stream
self._url('/exec/{0}/start', exec_id),
headers=headers,
data=data,
stream=stream
)
if socket:
......
......@@ -51,8 +51,36 @@ class ExecTest(DockerClientTest):
}
)
self.assertEqual(args[1]['headers'],
{'Content-Type': 'application/json'})
self.assertEqual(
args[1]['headers'], {
'Content-Type': 'application/json',
'Connection': 'Upgrade',
'Upgrade': 'tcp'
}
)
def test_exec_start_detached(self):
self.client.exec_start(fake_api.FAKE_EXEC_ID, detach=True)
args = fake_request.call_args
self.assertEqual(
args[0][1], url_prefix + 'exec/{0}/start'.format(
fake_api.FAKE_EXEC_ID
)
)
self.assertEqual(
json.loads(args[1]['data']), {
'Tty': False,
'Detach': True
}
)
self.assertEqual(
args[1]['headers'], {
'Content-Type': 'application/json'
}
)
def test_exec_inspect(self):
self.client.exec_inspect(fake_api.FAKE_EXEC_ID)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment