(ctx context.Context, dst io.Writer, inject inject.Injector)
| 197 | } |
| 198 | |
| 199 | func (p *ReverseProxy) copyResponse(ctx context.Context, dst io.Writer, inject inject.Injector) { |
| 200 | log := termlog.FromContext(ctx) |
| 201 | if p.FlushInterval != 0 { |
| 202 | if wf, ok := dst.(writeFlusher); ok { |
| 203 | mlw := &maxLatencyWriter{ |
| 204 | dst: wf, |
| 205 | latency: p.FlushInterval, |
| 206 | done: make(chan bool), |
| 207 | } |
| 208 | go mlw.flushLoop() |
| 209 | defer mlw.stop() |
| 210 | dst = mlw |
| 211 | } |
| 212 | } |
| 213 | _, err := inject.Copy(dst) |
| 214 | if err != nil { |
| 215 | log.Shout("Error forwarding data: %s", err) |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | type writeFlusher interface { |
| 220 | io.Writer |
no test coverage detected