Skip to content

Commit a4ce49f

Browse files
authored
Merge pull request #21 from markbirbeck/19-stream-for-follow-and-logs
19 stream for follow and logs
2 parents d87767d + 4569bab commit a4ce49f

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/lib/SwaggerModem.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ class SwaggerModem extends Modem {
9393
* in a URL.
9494
*/
9595

96-
if (options.options._query.stream === 'true') {
97-
options.isStream = true
98-
}
96+
options.isStream = ['follow', 'logs', 'stream']
97+
.some(key => options.options._query[key] === 'true')
9998

10099
/**
101100
* The options are ready to go:

test/SwaggerModem.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ tap.test('SwaggerModem', async t => {
3939
const id = res.Id
4040
req = builder.ContainerAttach({
4141
id,
42-
logs: true,
4342
stream: false,
4443
stdout: true,
4544
stderr: true
@@ -49,9 +48,14 @@ tap.test('SwaggerModem', async t => {
4948

5049
/**
5150
* Verify that we didn't get a streaming object:
51+
*
52+
* We could test against an empty string but when the test fails we will
53+
* get the entire streaming object displayed as 'not matching' the empty
54+
* string. Checking the type means that we get a much more compact error
55+
* message!
5256
*/
5357

54-
t.equal(res, '')
58+
t.type(res, 'string')
5559

5660
t.comment('deleting the created container')
5761

0 commit comments

Comments
 (0)