fastcgi: Fix for handling errors that come from responder

This commit is contained in:
Matthew Holt 2015-04-30 07:50:07 -06:00
parent 27722463a7
commit b51e8bc191

View file

@ -111,12 +111,15 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error)
w.WriteHeader(resp.StatusCode)
// Write the response body
// TODO: If this has an error, the response will already be
// partly written. We should copy out of resp.Body into a buffer
// first, then write it to the response...
_, err = io.Copy(w, resp.Body)
if err != nil {
return http.StatusBadGateway, err
}
return resp.StatusCode, nil
return 0, nil
}
}