diff --git a/secret_create.go b/secret_create.go index f92a3d1510..de8b041567 100644 --- a/secret_create.go +++ b/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/secret_create_test.go b/secret_create_test.go index b7def89d0e..cb378c77ff 100644 --- a/secret_create_test.go +++ b/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 }),