Fix logging message when content type is empty
@@ -137,7 +137,11 @@ func (r *Response) retryAfter() time.Duration {
// writes to a buffer, used for logging purposes
func (r *Response) writeBody(b *bytes.Buffer) error {
- if ct := r.Header.Get(HeaderContentType); !shouldLogBody(b, ct) {
+ ct := r.Header.Get(HeaderContentType)
+ if ct == "" {
+ fmt.Fprint(b, " Response contained no body\n")
+ return nil
+ } else if !shouldLogBody(b, ct) {
return nil
}
body, err := r.Payload()
