simplify code with http.Flusher type conversion (#325)
* simplify code with http.Flusher type conversion * simplify code with http.Flusher type conversion, better version
This commit is contained in:
@@ -74,6 +74,10 @@ func newDetailLoggedResponseWriter(writer *LoggedResponseWriter, buf *bytes.Buff
|
||||
}
|
||||
}
|
||||
|
||||
func (w *DetailLoggedResponseWriter) Flush() {
|
||||
w.writer.Flush()
|
||||
}
|
||||
|
||||
func (w *DetailLoggedResponseWriter) Header() http.Header {
|
||||
return w.writer.Header()
|
||||
}
|
||||
@@ -87,12 +91,6 @@ func (w *DetailLoggedResponseWriter) WriteHeader(code int) {
|
||||
w.writer.WriteHeader(code)
|
||||
}
|
||||
|
||||
func (w *DetailLoggedResponseWriter) Flush() {
|
||||
if flusher, ok := http.ResponseWriter(w.writer).(http.Flusher); ok {
|
||||
flusher.Flush()
|
||||
}
|
||||
}
|
||||
|
||||
func DetailedLogHandler(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
timer := utils.NewElapsedTimer()
|
||||
|
||||
Reference in New Issue
Block a user