From ed8122cd3b157e4564f1bd02403253e13fb8700f Mon Sep 17 00:00:00 2001 From: Pancakes Date: Sat, 27 Jul 2024 20:58:17 -0400 Subject: [PATCH] Don't defer redirects --- api/account/discord.go | 4 ++-- api/account/google.go | 4 ++-- api/endpoints.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/account/discord.go b/api/account/discord.go index eb5f776..5bb35e7 100644 --- a/api/account/discord.go +++ b/api/account/discord.go @@ -33,13 +33,13 @@ var ( func HandleDiscordCallback(w http.ResponseWriter, r *http.Request) (string, error) { code := r.URL.Query().Get("code") if code == "" { - defer http.Redirect(w, r, GameURL, http.StatusSeeOther) + http.Redirect(w, r, GameURL, http.StatusSeeOther) return "", errors.New("code is empty") } discordId, err := RetrieveDiscordId(code) if err != nil { - defer http.Redirect(w, r, GameURL, http.StatusSeeOther) + http.Redirect(w, r, GameURL, http.StatusSeeOther) return "", err } diff --git a/api/account/google.go b/api/account/google.go index 9efaadc..e81ac88 100644 --- a/api/account/google.go +++ b/api/account/google.go @@ -35,13 +35,13 @@ var ( func HandleGoogleCallback(w http.ResponseWriter, r *http.Request) (string, error) { code := r.URL.Query().Get("code") if code == "" { - defer http.Redirect(w, r, GameURL, http.StatusSeeOther) + http.Redirect(w, r, GameURL, http.StatusSeeOther) return "", errors.New("code is empty") } googleId, err := RetrieveGoogleId(code) if err != nil { - defer http.Redirect(w, r, GameURL, http.StatusSeeOther) + http.Redirect(w, r, GameURL, http.StatusSeeOther) return "", err } diff --git a/api/endpoints.go b/api/endpoints.go index 47c3e7c..b9802fe 100644 --- a/api/endpoints.go +++ b/api/endpoints.go @@ -635,7 +635,7 @@ func handleProviderCallback(w http.ResponseWriter, r *http.Request) { }) } - defer http.Redirect(w, r, account.GameURL, http.StatusSeeOther) + http.Redirect(w, r, account.GameURL, http.StatusSeeOther) } func handleProviderLogout(w http.ResponseWriter, r *http.Request) {