add middleware for perflite requests and delete cors from user and auth

handlers
This commit is contained in:
2025-10-11 11:07:43 +05:00
parent 6850701b47
commit 2ccab0a17f
5 changed files with 33 additions and 25 deletions
@@ -48,9 +48,6 @@ func (h *AuthHandler) Routes() chi.Router {
// Обработчик для OPTIONS запросов
func (h *AuthHandler) handleOptions(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS")
w.Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
w.Header().Set("Access-Control-Max-Age", "300")
w.WriteHeader(http.StatusOK)
}
@@ -71,9 +68,6 @@ type LoginRequest struct {
}
func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request) {
// Устанавливаем CORS заголовки
w.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin"))
w.Header().Set("Access-Control-Allow-Credentials", "true")
h.logger.Info("handling register request",
zap.String("method", r.Method),
@@ -170,9 +164,6 @@ func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request) {
}
func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request) {
// Устанавливаем CORS заголовки
w.Header().Set("Access-Control-Allow-Origin", r.Header.Get("Origin"))
w.Header().Set("Access-Control-Allow-Credentials", "true")
h.logger.Info("handling login request",
zap.String("method", r.Method),