Change upload response
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2022-01-24 19:15:43 +01:00
parent b559d28a38
commit 46401c1b98
6 changed files with 25 additions and 24 deletions

View File

@@ -159,7 +159,7 @@ func (c *Client) Download(ctx context.Context, id string) (io.ReadCloser, error)
return resp.Body, nil
}
func (c *Client) Upload(ctx context.Context, files ...*files.File) ([]api.ResponseAPIFilePost, error) {
func (c *Client) Upload(ctx context.Context, files ...*files.File) (*api.ResponseAPIFilePost, error) {
url := fmt.Sprintf("%s/api/file", c.BaseURL)
client := &http.Client{}
@@ -194,7 +194,7 @@ func (c *Client) Upload(ctx context.Context, files ...*files.File) ([]api.Respon
}
defer resp.Body.Close()
var expectedResp []api.ResponseAPIFilePost
var expectedResp *api.ResponseAPIFilePost
decoder := json.NewDecoder(resp.Body)
if err := decoder.Decode(&expectedResp); err != nil {

View File

@@ -120,7 +120,7 @@ func TestClient(t *testing.T) {
t.Fatalf("Error uploading: %s", err)
}
retrieved, err := srv.Files.Get(resp[0].ID)
retrieved, err := srv.Files.Get(resp.Files[0].ID)
if err != nil {
t.Fatalf("Error getting uploaded file from store: %s", err)
}