Merge pull request #4 from jryd/DownloadFile-fix
Update DownloadFile method to use generic http.Get()
This commit is contained in:
commit
a8fd8a8d65
4
util.go
4
util.go
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user