Implement http.Hijack interface in HTTPLoggingMiddleware
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
@ -46,6 +48,10 @@ func (writer *loggingResponseWriter) WriteHeader(code int) {
|
||||
writer.ResponseWriter.WriteHeader(code)
|
||||
}
|
||||
|
||||
func (writer *loggingResponseWriter) Hijack() (net.Conn, *bufio.ReadWriter, error) {
|
||||
return writer.ResponseWriter.(http.Hijacker).Hijack()
|
||||
}
|
||||
|
||||
// HTTPLoggingMiddleware returns an http.Handler that logs different information about every request
|
||||
func HTTPLoggingMiddleware(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
Reference in New Issue
Block a user