mirror of
https://github.com/harness/drone.git
synced 2025-05-11 22:50:11 +08:00
address comment
This commit is contained in:
parent
33f5719b3c
commit
9a4d7ba769
@ -97,7 +97,6 @@ func (c *HarnessCodeClient) CreateRepo(ctx context.Context, input repo.CreateInp
|
|||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.client.Do(req)
|
resp, err := c.client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("request execution failed: %w", err)
|
return nil, fmt.Errorf("request execution failed: %w", err)
|
||||||
}
|
}
|
||||||
@ -107,8 +106,12 @@ func (c *HarnessCodeClient) CreateRepo(ctx context.Context, input repo.CreateInp
|
|||||||
}
|
}
|
||||||
|
|
||||||
var repository Repository
|
var repository Repository
|
||||||
err = unmarshalResponse(resp, repository)
|
err = mapStatusCodeToError(resp.StatusCode)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = unmarshalResponse(resp, repository)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -118,13 +121,11 @@ func (c *HarnessCodeClient) CreateRepo(ctx context.Context, input repo.CreateInp
|
|||||||
func (c *HarnessCodeClient) DeleteRepo(ctx context.Context, input repo.CreateInput) error {
|
func (c *HarnessCodeClient) DeleteRepo(ctx context.Context, input repo.CreateInput) error {
|
||||||
path := fmt.Sprintf(pathDeleteRepo, c.client.accountId, c.client.orgId, c.client.projectId, input.UID, c.client.accountId)
|
path := fmt.Sprintf(pathDeleteRepo, c.client.accountId, c.client.orgId, c.client.projectId, input.UID, c.client.accountId)
|
||||||
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, appendPath(c.client.baseURL, path), nil)
|
req, err := http.NewRequestWithContext(ctx, http.MethodDelete, appendPath(c.client.baseURL, path), nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to create new http request : %w", err)
|
return fmt.Errorf("unable to create new http request : %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp, err := c.client.Do(req)
|
resp, err := c.client.Do(req)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("request execution failed: %w", err)
|
return fmt.Errorf("request execution failed: %w", err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user