Fix: notify bot
This commit is contained in:
@ -5,24 +5,22 @@ import (
|
||||
"crypto/hmac"
|
||||
"crypto/sha256"
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"golias/models"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
// LogRequests logs all HTTP requests with method, path and duration
|
||||
func LogRequests(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
// start := time.Now()
|
||||
// Wrap response writer to capture status code
|
||||
next.ServeHTTP(w, r)
|
||||
duration := time.Since(start)
|
||||
log.Debug("request completed",
|
||||
"method", r.Method,
|
||||
"path", r.URL.RequestURI(),
|
||||
"duration", duration.String(),
|
||||
)
|
||||
// duration := time.Since(start)
|
||||
// log.Debug("request completed",
|
||||
// "method", r.Method,
|
||||
// "path", r.URL.RequestURI(),
|
||||
// "duration", duration.String(),
|
||||
// )
|
||||
})
|
||||
}
|
||||
|
||||
@ -65,11 +63,11 @@ func GetSession(next http.Handler) http.Handler {
|
||||
return
|
||||
}
|
||||
userSession, err := cacheGetSession(sessionToken)
|
||||
log.Debug("userSession from cache", "us", userSession)
|
||||
// log.Debug("userSession from cache", "us", userSession)
|
||||
if err != nil {
|
||||
msg := "auth failed; session does not exists"
|
||||
err = errors.New(msg)
|
||||
log.Debug(msg, "error", err)
|
||||
// msg := "auth failed; session does not exists"
|
||||
// err = errors.New(msg)
|
||||
// log.Debug(msg, "error", err)
|
||||
next.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user