add user info to context request

This commit is contained in:
Kenta420-Poom 2023-09-20 12:17:14 +07:00
parent b49b2235db
commit 930911d7a9

View file

@ -116,9 +116,9 @@ func (s *Server) createHandler() {
var tokenInfo map[string]interface{}
json.NewDecoder(res.Body).Decode(&tokenInfo)
log.Println(tokenInfo)
context := context.WithValue(r.Context(), "user", tokenInfo)
next.ServeHTTP(w, r)
next.ServeHTTP(w, r.WithContext(context))
})
})