diff options
| author | mo khan <mo@mokhan.ca> | 2025-05-08 11:07:55 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-05-08 11:07:55 -0600 |
| commit | f5fd5ef8edc832f86c4cbb752ba4d27959753d19 (patch) | |
| tree | 11503c6901d2de7a0ef7b34008fb60c3b478fdc7 /app/controllers/sessions/controller.go | |
| parent | d4758497b63644b2baaef2115984fe7ba14fff2a (diff) | |
refactor: move html render to data transfer object
Diffstat (limited to 'app/controllers/sessions/controller.go')
| -rw-r--r-- | app/controllers/sessions/controller.go | 9 |
1 files changed, 1 insertions, 8 deletions
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) } |
