modified: serv_nginx/api_bb/internal/handlers/auth.go
add logger into updateProfile function
This commit is contained in:
@@ -270,6 +270,18 @@ func (h *AuthHandler) UpdateProfile(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Access-Control-Allow-Methods", "PUT, OPTIONS")
|
||||
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
|
||||
|
||||
// Логируем тело запроса для отладки
|
||||
bodyBytes, err := io.ReadAll(r.Body)
|
||||
if err != nil {
|
||||
utils.RespondWithError(w, http.StatusBadRequest, "Failed to read request body: "+err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
// Восстанавливаем тело для дальнейшего использования
|
||||
r.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))
|
||||
|
||||
fmt.Printf("Raw request body: %s\n", string(bodyBytes))
|
||||
|
||||
// Получаем пользователя из контекста
|
||||
currentUser, ok := middleware.GetUserFromContext(r.Context())
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user