Skip to content

Commit 9ff383b

Browse files
committed
Bugfix options not being applied properly
1 parent 6854e1e commit 9ff383b

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lup-docker",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"description": "NodeJS library to interact with the Docker engine.",
55
"main": "./lib/index",
66
"types": "./lib/index.d.ts",

src/__tests__/Docker.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import DockerClient from '../client';
22

33
test('getContainers', async () => {
44
const client = new DockerClient();
5-
const containers = await client.getContainers();
6-
//console.log(JSON.stringify(containers, null, 2));
5+
const containers = await client.getContainers({ all: true });
6+
console.log(JSON.stringify(containers, null, 2));
77
});
88

99
/*

src/client.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class DockerClient {
389389
if (options?.force) query.force = 'true';
390390
if (options?.link) query.link = 'true';
391391
if (options?.volumes) query.v = 'true';
392-
return this.requestJson('DELETE', '/containers/' + containerIdOrName, query).then<
392+
return this.requestJson('DELETE', '/containers/' + containerIdOrName, { query }).then<
393393
DockerResult<{}, DockerDeleteContainerResponseError>
394394
>((response) => {
395395
if (!response.ok || response.body.message) {
@@ -599,7 +599,7 @@ class DockerClient {
599599
if (Object.keys(json).length > 0) query.filters = JSON.stringify(json);
600600
}
601601

602-
return this.requestJson('GET', '/containers/json', query).then<DockerResult<DockerContainer[]>>((response) => {
602+
return this.requestJson('GET', '/containers/json', { query }).then<DockerResult<DockerContainer[]>>((response) => {
603603
if (!response.ok || response.body.message) {
604604
return { error: response.error! };
605605
}
@@ -716,7 +716,7 @@ class DockerClient {
716716
}
717717
if (options?.manifests) query.manifests = 'true';
718718
if (options?.sharedSize) query['shared-size'] = 'true';
719-
return this.requestJson('GET', '/images/json', query).then<DockerResult<DockerImage[]>>((response) => {
719+
return this.requestJson('GET', '/images/json', { query }).then<DockerResult<DockerImage[]>>((response) => {
720720
if (!response.ok) return { error: response.error! };
721721
return { success: (response.body as any[]).map<DockerImage>((image) => decodeDockerImage(image)!) };
722722
});
@@ -760,7 +760,7 @@ class DockerClient {
760760
): Promise<DockerResult<{}, DockerKillContainerResponseError>> {
761761
const query: { [key: string]: string } = {};
762762
if (signal) query.signal = signal.toString();
763-
return this.requestJson('POST', '/containers/' + containerIdOrName + '/kill', query).then<
763+
return this.requestJson('POST', '/containers/' + containerIdOrName + '/kill', { query }).then<
764764
DockerResult<{}, DockerKillContainerResponseError>
765765
>((response) => {
766766
if (!response.ok || response.body.message) {
@@ -831,7 +831,7 @@ class DockerClient {
831831
const query: { [key: string]: string } = {};
832832
if (options?.signal) query.signal = options.signal.toString();
833833
if (options?.timeout !== undefined) query.t = options.timeout.toString();
834-
return this.requestJson('POST', '/containers/' + containerIdOrName + '/restart', query).then<
834+
return this.requestJson('POST', '/containers/' + containerIdOrName + '/restart', { query }).then<
835835
DockerResult<{}, DockerRestartContainerResponseError>
836836
>((response) => {
837837
if (!response.ok || response.body.message) {
@@ -861,7 +861,7 @@ class DockerClient {
861861
): Promise<DockerResult<{}, DockerStartContainerResponseError>> {
862862
const query: { [key: string]: string } = {};
863863
if (detachKeys) query.detachKeys = detachKeys;
864-
return this.requestJson('POST', '/containers/' + containerIdOrName + '/start', query).then<
864+
return this.requestJson('POST', '/containers/' + containerIdOrName + '/start', { query }).then<
865865
DockerResult<{}, DockerStartContainerResponseError>
866866
>((response) => {
867867
if (!response.ok || response.body.message) {
@@ -893,7 +893,7 @@ class DockerClient {
893893
const query: { [key: string]: string } = {};
894894
if (options?.signal) query.signal = options.signal.toString();
895895
if (options?.timeout !== undefined) query.t = options.timeout.toString();
896-
return this.requestJson('POST', '/containers/' + containerIdOrName + '/stop', query).then<
896+
return this.requestJson('POST', '/containers/' + containerIdOrName + '/stop', { query }).then<
897897
DockerResult<{}, DockerStopContainerResponseError>
898898
>((response) => {
899899
if (!response.ok || response.body.message) {

0 commit comments

Comments
 (0)