29 lines
449 B
Go
29 lines
449 B
Go
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
|
|
|
|
|
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),
|
|
}
|
|
}
|