Merge pull request #4 from jryd/DownloadFile-fix

Update DownloadFile method to use generic http.Get()
This commit is contained in:
jeffreydwalter 2018-12-26 15:46:01 -06:00 committed by GitHub
commit a8fd8a8d65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,10 +103,12 @@ func (a *Arlo) DownloadFile(url, to string) error {
func (a *Arlo) DownloadFile(url string, w io.Writer) error { func (a *Arlo) DownloadFile(url string, w io.Writer) error {
msg := fmt.Sprintf("failed to download file (%s)", url) msg := fmt.Sprintf("failed to download file (%s)", url)
resp, err := a.get(url, "", nil)
resp, err := http.Get(url)
if err != nil { if err != nil {
return errors.WithMessage(err, msg) return errors.WithMessage(err, msg)
} }
defer resp.Body.Close() defer resp.Body.Close()
_, err = io.Copy(w, resp.Body) _, err = io.Copy(w, resp.Body)