MCPcopy
hub / github.com/cortesi/devd / copyResponse

Method copyResponse

reverseproxy/reverseproxy.go:199–217  ·  view source on GitHub ↗
(ctx context.Context, dst io.Writer, inject inject.Injector)

Source from the content-addressed store, hash-verified

197}
198
199func (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
219type writeFlusher interface {
220 io.Writer

Callers 1

ServeHTTPContextMethod · 0.95

Calls 3

flushLoopMethod · 0.95
stopMethod · 0.95
CopyMethod · 0.65

Tested by

no test coverage detected