Skip to content

Commit

Permalink
fix: upload app source buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
moroderNumerous committed Jun 10, 2024
1 parent 05de2a4 commit 8af23de
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/internal/app/upload_app_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (s *Service) UploadAppSource(uploadURL string, archive io.Reader) error {
return err
}

req, err := http.NewRequest(http.MethodPut, uploadURL, archive)
req, err := http.NewRequest(http.MethodPut, uploadURL, &buf)
if err != nil {
return err
}
Expand Down
6 changes: 3 additions & 3 deletions cli/internal/app/upload_app_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func TestUploadAppSource(t *testing.T) {
doer.On("Do", mock.Anything).Return(nilResp, testError)
s := Service{uploadDoer: &doer}

err := s.UploadAppSource("http://some-upload-url", nil)
err := s.UploadAppSource("http://some-upload-url", io.NopCloser(bytes.NewReader([]byte(""))))

assert.ErrorIs(t, err, testError)
})
Expand All @@ -33,15 +33,15 @@ func TestUploadAppSource(t *testing.T) {
doer.On("Do", mock.Anything).Return(&resp, nil)
s := Service{uploadDoer: &doer}

err := s.UploadAppSource("http://some-upload-url", nil)
err := s.UploadAppSource("http://some-upload-url", io.NopCloser(bytes.NewReader([]byte(""))))

assert.ErrorIs(t, err, ErrAppSourceUpload)
})

t.Run("given invalid upload URL then it returns error", func(t *testing.T) {
s := Service{uploadDoer: &test.MockDoer{}}

err := s.UploadAppSource("://invalid-url", nil)
err := s.UploadAppSource("://invalid-url", io.NopCloser(bytes.NewReader([]byte(""))))

assert.Error(t, err)
})
Expand Down

0 comments on commit 8af23de

Please sign in to comment.