From 17c4619fcbf022eaff1937149ef6fa46a9a617b4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Aug 2018 16:29:06 -0700 Subject: [PATCH] Remove work-around for httputil.Dump --- api.go | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/api.go b/api.go index d8c47aa3e..7c93ca1bb 100644 --- a/api.go +++ b/api.go @@ -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 } }