mirror of
https://github.com/golang/go.git
synced 2024-09-29 06:17:11 +00:00
misc/dashboard/builder: check http status before processing response
Occasionally GAE will return a 500 error response, don't treat this as a valid JSON body. R=adg, dsymonds CC=golang-dev https://golang.org/cl/6775066
This commit is contained in:
parent
71d9e956a0
commit
be6afde348
@ -56,8 +56,10 @@ func dash(meth, cmd string, args url.Values, req, resp interface{}) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer r.Body.Close()
|
||||
if r.StatusCode != http.StatusOK {
|
||||
return fmt.Errorf("bad http response: %v", r.Status)
|
||||
}
|
||||
body := new(bytes.Buffer)
|
||||
if _, err := body.ReadFrom(r.Body); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user