package stream import ( "net/http/httptest" ) type Recorder struct { *httptest.ResponseRecorder closeStream chan bool } func (r *Recorder) CloseNotify() <-chan bool { return r.closeStream } func (r *Recorder) Close() { r.closeStream <- true } func NewRecorder() *Recorder{ return &Recorder{ httptest.NewRecorder(), make(chan bool), } }