refactor: use 'c' alias for constants package
- Update all imports from 'constants' to 'c' for brevity - Replace all 'constants.' references with 'c.' - Fix remaining hardcoded content-type headers in httputil - Fix remaining hardcoded User-Agent and Accept headers - Rename CSRF receiver from 'c' to 'csrf' to avoid conflict - Add ContentTypePlainSimple constant for Accept header matching - Fix JSONCached to use proper integer formatting
This commit is contained in:
@@ -8,7 +8,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/juanatsap/cv-site/internal/constants"
|
||||
c "github.com/juanatsap/cv-site/internal/constants"
|
||||
"github.com/juanatsap/cv-site/internal/httputil"
|
||||
"github.com/juanatsap/cv-site/internal/services"
|
||||
)
|
||||
@@ -173,7 +173,7 @@ func (h *CVHandler) renderContactSuccess(w http.ResponseWriter, r *http.Request,
|
||||
}
|
||||
|
||||
// Render the success template
|
||||
w.Header().Set(constants.HeaderContentType, constants.ContentTypeHTML)
|
||||
w.Header().Set(c.HeaderContentType, c.ContentTypeHTML)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
tmpl, err := h.templates.Render("contact-success")
|
||||
@@ -224,7 +224,7 @@ func (h *CVHandler) renderContactError(w http.ResponseWriter, r *http.Request, e
|
||||
// Render the error template
|
||||
// Return 200 OK with error content - HTMX 1.9.x logs console.error for non-2xx responses
|
||||
// Validation errors are expected form feedback, not system errors
|
||||
w.Header().Set(constants.HeaderContentType, constants.ContentTypeHTML)
|
||||
w.Header().Set(c.HeaderContentType, c.ContentTypeHTML)
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
tmpl, err := h.templates.Render("contact-error")
|
||||
|
||||
Reference in New Issue
Block a user