mirror of https://github.com/Xhofe/alist
fix: http response body not close on status >= 400 (close #5163)
parent
6f6d20e1ba
commit
f2f312b43a
|
@ -224,9 +224,10 @@ func RequestHttp(ctx context.Context, httpMethod string, headerOverride http.Hea
|
|||
res.Header.Del("set-cookie")
|
||||
if res.StatusCode >= 400 {
|
||||
all, _ := io.ReadAll(res.Body)
|
||||
_ = res.Body.Close()
|
||||
msg := string(all)
|
||||
log.Debugln(msg)
|
||||
return res, errors.New(msg)
|
||||
return nil, fmt.Errorf("http request [%s] failure,status: %d response:%s", URL, res.StatusCode, msg)
|
||||
}
|
||||
return res, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue