27 lines
365 B
Go
27 lines
365 B
Go
|
|
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),
|
|
}
|
|
}
|