mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
(fix #543)added body to error when Post encounter 4xx response
This commit is contained in:
parent
e0dfa7a069
commit
3bf883327e
@ -48,10 +48,14 @@ func Post(url string, values url.Values) ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
defer r.Body.Close()
|
||||
if r.StatusCode >= 400 {
|
||||
return nil, fmt.Errorf("%s: %s", url, r.Status)
|
||||
}
|
||||
b, err := ioutil.ReadAll(r.Body)
|
||||
if r.StatusCode >= 400 {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%s: %d - %s", url, r.StatusCode, string(b))
|
||||
} else {
|
||||
return nil, fmt.Errorf("%s: %s", url, r.Status)
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user