Skip to content

Commit

Permalink
refactor: accesslog and handler.
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez authored and traefiker committed Mar 18, 2019
1 parent 44ef773 commit 19aafb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/middlewares/accesslog/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type Handler struct {
func WrapHandler(handler *Handler) alice.Constructor {
return func(next http.Handler) (http.Handler, error) {
return http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
handler.ServeHTTP(rw, req, next.ServeHTTP)
handler.ServeHTTP(rw, req, next)
}), nil
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@ func GetLogData(req *http.Request) *LogData {
return nil
}

func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) {
func (h *Handler) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.Handler) {
now := time.Now().UTC()

core := CoreLogData{
Expand Down
4 changes: 2 additions & 2 deletions pkg/middlewares/accesslog/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestLogRotation(t *testing.T) {
writeDone := make(chan bool)
go func() {
for i := 0; i < iterations; i++ {
logHandler.ServeHTTP(recorder, req, next)
logHandler.ServeHTTP(recorder, req, http.HandlerFunc(next))
if i == iterations/2 {
halfDone <- true
}
Expand Down Expand Up @@ -624,7 +624,7 @@ func doLogging(t *testing.T, config *types.AccessLog) {
},
}

logger.ServeHTTP(httptest.NewRecorder(), req, logWriterTestHandlerFunc)
logger.ServeHTTP(httptest.NewRecorder(), req, http.HandlerFunc(logWriterTestHandlerFunc))
}

func logWriterTestHandlerFunc(rw http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit 19aafb3

Please sign in to comment.