mirror of
https://github.com/drone-plugins/drone-download.git
synced 2026-06-16 14:50:33 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67694d2750 | |||
| ccc30ebd8d | |||
| 49372d3e9d | |||
| e12b6abe00 |
@@ -57,6 +57,13 @@ func (p Plugin) Exec() error {
|
||||
InsecureSkipVerify: p.Config.SkipVerify,
|
||||
},
|
||||
},
|
||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||
if p.Config.Username != "" && p.Config.Password != "" {
|
||||
req.SetBasicAuth(p.Config.Username, p.Config.Password)
|
||||
}
|
||||
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
req, err := http.NewRequest(
|
||||
@@ -81,6 +88,10 @@ func (p Plugin) Exec() error {
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return errors.Errorf("request failed, status %s", http.StatusText(resp.StatusCode))
|
||||
}
|
||||
|
||||
target, err := os.Create(destination)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user