Skip to content

Commit

Permalink
client.ContainerWait(): don't send empty "condition" query parameter
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thaJeztah committed Feb 14, 2022
1 parent 5e2b7de commit a832635
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/container_wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit a832635

Please sign in to comment.