check status code
This commit is contained in:
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
@ -39,6 +40,12 @@ func (ctx *renderContext) distFetch(path ...string) (outPath string, err error)
|
||||
return
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
err = fmt.Errorf("wrong status: %s", resp.Status)
|
||||
resp.Body.Close()
|
||||
return
|
||||
}
|
||||
|
||||
tempOutPath := filepath.Join(filepath.Dir(outPath), "._part_"+filepath.Base(outPath))
|
||||
|
||||
done := make(chan error, 1)
|
||||
|
Reference in New Issue
Block a user