Response implements Printer.Response.
(resp *http.Response, duration time.Duration)
| 118 | |
| 119 | // Response implements Printer.Response. |
| 120 | func (p DebugPrinter) Response(resp *http.Response, duration time.Duration) { |
| 121 | if resp == nil { |
| 122 | return |
| 123 | } |
| 124 | |
| 125 | dump, err := httputil.DumpResponse(resp, p.body) |
| 126 | if err != nil { |
| 127 | panic(err) |
| 128 | } |
| 129 | |
| 130 | text := strings.Replace(string(dump), "\r\n", "\n", -1) |
| 131 | lines := strings.SplitN(text, "\n", 2) |
| 132 | |
| 133 | p.logger.Logf("%s %s\n%s", lines[0], duration, lines[1]) |
| 134 | } |
| 135 | |
| 136 | // WebsocketWrite implements WebsocketPrinter.WebsocketWrite. |
| 137 | func (p DebugPrinter) WebsocketWrite(typ int, content []byte, closeCode int) { |