Fix panic
Anirudh Oppiliappan x@icyphox.sh
Sun, 27 Nov 2022 12:51:29 +0530
1 files changed,
6 insertions(+),
3 deletions(-)
jump to
M
main.go
→
main.go
@@ -33,10 +33,13 @@ }
func getKey(r *http.Request) string { var key string - header := r.Header.Get("Authorization") - key = strings.Split(header, " ")[1] + key = r.FormValue("key") if key == "" { - key = r.FormValue("key") + header := r.Header.Get("Authorization") + split := strings.Split(header, " ") + if len(split) == 2 { + key = split[1] + } } return key }