Merge pull request #28529 from allencloud/update-secret-create-url

fix secret create url for consistency
This commit is contained in:
Victor Vieux 2016-11-22 09:55:17 -08:00 committed by GitHub
commit 4d87ef4432
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
}), }),