diff --git a/api/server/router/swarm/cluster.go b/api/server/router/swarm/cluster.go index 352a80db14..e2d5ad19b8 100644 --- a/api/server/router/swarm/cluster.go +++ b/api/server/router/swarm/cluster.go @@ -44,7 +44,7 @@ func (sr *swarmRouter) initRoutes() { router.NewGetRoute("/tasks", sr.getTasks), router.NewGetRoute("/tasks/{id}", sr.getTask), router.NewGetRoute("/secrets", sr.getSecrets), - router.NewPostRoute("/secrets", sr.createSecret), + router.NewPostRoute("/secrets/create", sr.createSecret), router.NewDeleteRoute("/secrets/{id}", sr.removeSecret), router.NewGetRoute("/secrets/{id}", sr.getSecret), router.NewPostRoute("/secrets/{id}/update", sr.updateSecret), diff --git a/client/secret_create.go b/client/secret_create.go index f92a3d1510..de8b041567 100644 --- a/client/secret_create.go +++ b/client/secret_create.go @@ -13,7 +13,7 @@ func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (t var headers map[string][]string var response types.SecretCreateResponse - resp, err := cli.post(ctx, "/secrets", nil, secret, headers) + resp, err := cli.post(ctx, "/secrets/create", nil, secret, headers) if err != nil { return response, err } diff --git a/client/secret_create_test.go b/client/secret_create_test.go index b7def89d0e..cb378c77ff 100644 --- a/client/secret_create_test.go +++ b/client/secret_create_test.go @@ -25,7 +25,7 @@ func TestSecretCreateError(t *testing.T) { } func TestSecretCreate(t *testing.T) { - expectedURL := "/secrets" + expectedURL := "/secrets/create" client := &Client{ client: newMockClient(func(req *http.Request) (*http.Response, error) { if !strings.HasPrefix(req.URL.Path, expectedURL) { @@ -41,7 +41,7 @@ func TestSecretCreate(t *testing.T) { return nil, err } return &http.Response{ - StatusCode: http.StatusOK, + StatusCode: http.StatusCreated, Body: ioutil.NopCloser(bytes.NewReader(b)), }, nil }), diff --git a/integration-cli/daemon_swarm.go b/integration-cli/daemon_swarm.go index 9a8de41d6c..cb364f0443 100644 --- a/integration-cli/daemon_swarm.go +++ b/integration-cli/daemon_swarm.go @@ -285,7 +285,7 @@ func (d *SwarmDaemon) listServices(c *check.C) []swarm.Service { } func (d *SwarmDaemon) createSecret(c *check.C, secretSpec swarm.SecretSpec) string { - status, out, err := d.SockRequest("POST", "/secrets", secretSpec) + status, out, err := d.SockRequest("POST", "/secrets/create", secretSpec) c.Assert(err, checker.IsNil, check.Commentf(string(out))) c.Assert(status, checker.Equals, http.StatusCreated, check.Commentf("output: %q", string(out)))