mirror of https://github.com/docker/cli.git
update secret create url for consistency
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
d9a5f6c80e
commit
42788cad9c
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Reference in New Issue