Skip to content

Commit

Permalink
Remove work-around for httputil.Dump (#1017)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and nitisht committed Aug 16, 2018
1 parent eccfe95 commit 1452266
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,22 +455,9 @@ func (c Client) dumpHTTP(req *http.Request, resp *http.Response) error {
return err
}
} else {
// WORKAROUND for https://github.com/golang/go/issues/13942.
// httputil.DumpResponse does not print response headers for
// all successful calls which have response ContentLength set
// to zero. Keep this workaround until the above bug is fixed.
if resp.ContentLength == 0 {
var buffer bytes.Buffer
if err = resp.Header.Write(&buffer); err != nil {
return err
}
respTrace = buffer.Bytes()
respTrace = append(respTrace, []byte("\r\n")...)
} else {
respTrace, err = httputil.DumpResponse(resp, false)
if err != nil {
return err
}
respTrace, err = httputil.DumpResponse(resp, false)
if err != nil {
return err
}
}

Expand Down

0 comments on commit 1452266

Please sign in to comment.