From f5fd5ef8edc832f86c4cbb752ba4d27959753d19 Mon Sep 17 00:00:00 2001 From: mo khan Date: Thu, 8 May 2025 11:07:55 -0600 Subject: refactor: move html render to data transfer object --- app/controllers/sessions/controller.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'app/controllers/sessions/controller.go') diff --git a/app/controllers/sessions/controller.go b/app/controllers/sessions/controller.go index d5b2ba6..afc44f7 100644 --- a/app/controllers/sessions/controller.go +++ b/app/controllers/sessions/controller.go @@ -7,7 +7,6 @@ import ( "github.com/xlgmokha/x/pkg/env" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/cfg" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/middleware" - "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/app/views" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/oidc" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/pls" "gitlab.com/gitlab-org/software-supply-chain-security/authorization/sparkled/pkg/web" @@ -102,13 +101,7 @@ func (c *Controller) Destroy(w http.ResponseWriter, r *http.Request) { func (c *Controller) redirectTo(w http.ResponseWriter, r *http.Request, location string) { if env.Fetch("APP_ENV", "development") == "production" { - w.WriteHeader(http.StatusOK) - w.Header().Add("Content-Type", "text/html") - - if err := views.Render(w, "sessions/redirect", &RedirectDTO{URL: location}); err != nil { - pls.LogError(r.Context(), err) - w.WriteHeader(http.StatusInternalServerError) - } + (&RedirectDTO{URL: location}).ServeHTTP(w, r) } else { http.Redirect(w, r, location, http.StatusFound) } -- cgit v1.2.3