update secret create url for consistency

Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
allencloud 2016-11-17 10:51:16 +08:00
parent d9a5f6c80e
commit 42788cad9c
2 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ func (cli *Client) SecretCreate(ctx context.Context, secret swarm.SecretSpec) (t
var headers map[string][]string var headers map[string][]string
var response types.SecretCreateResponse 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 { if err != nil {
return response, err return response, err
} }

View File

@ -25,7 +25,7 @@ func TestSecretCreateError(t *testing.T) {
} }
func TestSecretCreate(t *testing.T) { func TestSecretCreate(t *testing.T) {
expectedURL := "/secrets" expectedURL := "/secrets/create"
client := &Client{ client := &Client{
client: newMockClient(func(req *http.Request) (*http.Response, error) { client: newMockClient(func(req *http.Request) (*http.Response, error) {
if !strings.HasPrefix(req.URL.Path, expectedURL) { if !strings.HasPrefix(req.URL.Path, expectedURL) {
@ -41,7 +41,7 @@ func TestSecretCreate(t *testing.T) {
return nil, err return nil, err
} }
return &http.Response{ return &http.Response{
StatusCode: http.StatusOK, StatusCode: http.StatusCreated,
Body: ioutil.NopCloser(bytes.NewReader(b)), Body: ioutil.NopCloser(bytes.NewReader(b)),
}, nil }, nil
}), }),