fix status check

This commit is contained in:
gutmet 2020-08-08 12:00:45 +02:00
parent 56db7d59dd
commit d93ac320ec

View File

@ -131,7 +131,7 @@ func send(client *http.Client, url string, vals url.Values) []byte {
log(err)
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if resp.StatusCode != http.StatusOK {
if resp.StatusCode < 200 || resp.StatusCode > 299 {
fmt.Fprintln(os.Stderr, "response:", resp, "\n")
fmt.Fprintln(os.Stderr, "body:", string(body), "\n")
log(errors.New("HTTP status " + fmt.Sprint(resp.StatusCode)))