Commit be6afde3 authored by Dave Cheney's avatar Dave Cheney

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
parent 71d9e956
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment