Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional headers to DownloadableFile messages when downloading files #306

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
7 changes: 7 additions & 0 deletions client/internal/packagessyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@
return fmt.Errorf("cannot download file from %s: %v", file.DownloadUrl, err)
}

// Add optional headers if they exist
if file.Headers != nil {

Check failure on line 284 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)

Check failure on line 284 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)

Check failure on line 284 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / test-coverage

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)

Check failure on line 284 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / build-and-test

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)
RichardChukwu marked this conversation as resolved.
Show resolved Hide resolved
for _, header := range file.Headers.Headers {

Check failure on line 285 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers) (compile)

Check failure on line 285 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / staticcheck (project)

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers) (compile)

Check failure on line 285 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / test-coverage

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)

Check failure on line 285 in client/internal/packagessyncer.go

View workflow job for this annotation

GitHub Actions / build-and-test

file.Headers undefined (type *protobufs.DownloadableFile has no field or method Headers)
req.Header.Add(header.Key, header.Value)
}
}

resp, err := http.DefaultClient.Do(req)
if err != nil {
return fmt.Errorf("cannot download file from %s: %v", file.DownloadUrl, err)
Expand Down
Loading