From a832635e5135eb82fe6cd0698f533ae9426eeb40 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 11 Feb 2022 22:54:20 +0100 Subject: [PATCH] client.ContainerWait(): don't send empty "condition" query parameter The client would always send a value, even if no `condition` was set; Calling POST /v1.41/containers/foo/wait?condition= This patch changes the client to not send the parameter if it's empty (and the API default value should be used). Signed-off-by: Sebastiaan van Stijn --- client/container_wait.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/container_wait.go b/client/container_wait.go index 6ab8c1da96..e9b134c9d2 100644 --- a/client/container_wait.go +++ b/client/container_wait.go @@ -33,7 +33,9 @@ func (cli *Client) ContainerWait(ctx context.Context, containerID string, condit errC := make(chan error, 1) query := url.Values{} - query.Set("condition", string(condition)) + if condition != "" { + query.Set("condition", string(condition)) + } resp, err := cli.post(ctx, "/containers/"+containerID+"/wait", query, nil, nil) if err != nil {