diff options
Diffstat (limited to 'git-codereview/api.go')
| -rw-r--r-- | git-codereview/api.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/git-codereview/api.go b/git-codereview/api.go index 440489f..7a0da55 100644 --- a/git-codereview/api.go +++ b/git-codereview/api.go @@ -232,11 +232,15 @@ func (e *gerritError) Error() string { // anti-xss line (]})' or some such) followed by JSON. // If requestBody != nil, gerritAPI sets the Content-Type to application/json. func gerritAPI(path string, requestBody []byte, target interface{}) (err error) { + var respBodyBytes []byte defer func() { if err != nil { // os.Stderr, not stderr(), because the latter is not safe for // use from multiple goroutines. fmt.Fprintf(os.Stderr, "git-codereview: fetch %s: %v\n", path, err) + if len(respBodyBytes) > 0 { + fmt.Fprintf(os.Stderr, "Gerrit response:\n%s\n", respBodyBytes) + } } }() @@ -281,6 +285,8 @@ func gerritAPI(path string, requestBody []byte, target interface{}) (err error) body, err := ioutil.ReadAll(resp.Body) resp.Body.Close() + respBodyBytes = body + if err != nil { return fmt.Errorf("reading response body: %v", err) } |
