Skip to content

Commit

Permalink
add redirect logic
Browse files Browse the repository at this point in the history
  • Loading branch information
codingkarthik committed Oct 24, 2024
1 parent 96e8d88 commit 8870ee8
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion registry-automation/cmd/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ func generateGCPObjectName(namespace, connectorName, version string) string {

func downloadFile(sourceURL, destination string, headers map[string]string) error {
// Create a new HTTP client
client := &http.Client{}
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
// Copy headers to redirected request
for key, values := range headers {
req.Header.Set(key, values)
}
return nil
},
}

// Create a new GET request
req, err := http.NewRequest("GET", sourceURL, nil)
Expand Down

0 comments on commit 8870ee8

Please sign in to comment.