add flusher interface and implementation

This commit is contained in:
Pedro Pérez 2024-11-25 11:09:39 +01:00
parent 8da9de3177
commit 4ead8a4600

5
ron.go
View File

@ -22,6 +22,7 @@ type (
responseWriterWrapper struct { responseWriterWrapper struct {
http.ResponseWriter http.ResponseWriter
http.Flusher
headerWritten bool headerWritten bool
} }
@ -76,6 +77,10 @@ func (w *responseWriterWrapper) Write(b []byte) (int, error) {
return w.ResponseWriter.Write(b) return w.ResponseWriter.Write(b)
} }
func (w *responseWriterWrapper) Flush() {
w.ResponseWriter.(http.Flusher).Flush()
}
func defaultEngine() *Engine { func defaultEngine() *Engine {
return &Engine{ return &Engine{
mux: http.NewServeMux(), mux: http.NewServeMux(),