Merge pull request #5 from drone-plugins/redirect-basicauth

Add basic auth on redirects
This commit is contained in:
Thomas Boerger
2018-05-02 13:01:27 +02:00
committed by GitHub
+7
View File
@@ -57,6 +57,13 @@ func (p Plugin) Exec() error {
InsecureSkipVerify: p.Config.SkipVerify, 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( req, err := http.NewRequest(