dnaeon / go-vcr

Record and replay your HTTP interactions for fast, deterministic and accurate tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CancelRequest recursively calls itself leading to `fatal error: stack overflow`

ajwerner opened this issue · comments

// CancelRequest implements the github.com/coreos/etcd/client.CancelableTransport interface
func (r *Recorder) CancelRequest(req *http.Request) {
	r.CancelRequest(req)
}

https://github.com/dnaeon/go-vcr/blob/master/recorder/recorder.go#L214

Should probably be:

// CancelRequest implements the github.com/coreos/etcd/client.CancelableTransport interface
func (r *Recorder) CancelRequest(req *http.Request) {
        // copy the interface to not import etcd/client
        type cancelableTransport interface {
             CancelRequest(req *http.Request)
        }
        if ct, ok := r.realTransport.(cancelableTransport); ok {
            ct.CancelRequest(req)
        }
}