Skip to content

Commit

Permalink
Making function cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
mativm02 committed Jan 6, 2025
1 parent 0377996 commit 3068e15
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tothic/tothic.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,14 @@ func BeginAuthHandler(res http.ResponseWriter, req *http.Request, toth *toth.Tot
var GetState = func(req *http.Request) string {
params := req.URL.Query()

var state string
state := params.Get("state")

if params.Encode() == "" && req.Method == http.MethodPost {
if state == "" && req.Method == http.MethodPost {
state = req.FormValue("state")
} else {
state = params.Get("state")
}

if state == "" {
// no "state" found, returning the default value
state = "state"
}

Expand Down

0 comments on commit 3068e15

Please sign in to comment.