From 5f8650d55de688af6dd01c07e9e0343c40c00fc7 Mon Sep 17 00:00:00 2001 From: Hugo <hnouts@grandlyon.com> Date: Fri, 17 Apr 2020 15:09:04 +0200 Subject: [PATCH] log entry query, variables, redirection query --- main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.go b/main.go index de781c1..7d80547 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( "flag" + "fmt" "net/http" "strconv" "strings" @@ -17,11 +18,17 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { query := r.URL.Query() + fmt.Println(query) host := strings.Split(query.Get("state"), "-")[0] + fmt.Println(host) state := query.Get("state") + fmt.Println(state) usagePointId := query.Get("usage_point_id") + fmt.Println(usagePointId) code := query.Get("code") + fmt.Println(code) redir := "http://" + host + "?code=" + code + "?state="+ state +"&usage_point_id=" + usagePointId + fmt.Println(redir) http.Redirect(w, r, redir, 302) }) -- GitLab