27 lines
632 B
Go
27 lines
632 B
Go
package middleware
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func Middleware(next http.Handler) http.Handler {
|
|
return http.HandlerFunc(
|
|
func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
// tokenString := r.Header.Get("Authorization")
|
|
// if tokenString == "" {
|
|
// w.WriteHeader(http.StatusUnauthorized)
|
|
// return
|
|
// }
|
|
// email, err := auth.ValidateToken(tokenString)
|
|
// if err != nil {
|
|
// w.WriteHeader(http.StatusUnauthorized)
|
|
// return
|
|
// }
|
|
//ctx := context.WithValue(r.Context(), "email", email)
|
|
next.ServeHTTP(w, r.WithContext(r.Context()))
|
|
},
|
|
)
|
|
}
|