Skip to content

Commit

Permalink
🐛 Check status code when downloading front...
Browse files Browse the repository at this point in the history
  • Loading branch information
nlepage committed Oct 3, 2019
1 parent ccdd3d1 commit 4281526
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions httputil/downloadTgzToDir.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package httputil
import (
"archive/tar"
"compress/gzip"
"fmt"
"io"
"net/http"
"os"
Expand All @@ -19,6 +20,10 @@ func DownloadTgzToDir(url, path string) error {
}
defer res.Body.Close()

if res.StatusCode != http.StatusOK {
return fmt.Errorf("GET %s returned status %d", url, res.StatusCode)
}

if err := os.RemoveAll(path); err != nil {
return err
}
Expand Down

0 comments on commit 4281526

Please sign in to comment.