Skip to content
Snippets Groups Projects
Commit 5f8650d5 authored by Hugo NOUTS's avatar Hugo NOUTS
Browse files

log entry query, variables, redirection query

parent 83e6451c
No related branches found
No related tags found
No related merge requests found
Pipeline #4915 passed
...@@ -2,6 +2,7 @@ package main ...@@ -2,6 +2,7 @@ package main
import ( import (
"flag" "flag"
"fmt"
"net/http" "net/http"
"strconv" "strconv"
"strings" "strings"
...@@ -17,11 +18,17 @@ func main() { ...@@ -17,11 +18,17 @@ func main() {
mux := http.NewServeMux() mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query() query := r.URL.Query()
fmt.Println(query)
host := strings.Split(query.Get("state"), "-")[0] host := strings.Split(query.Get("state"), "-")[0]
fmt.Println(host)
state := query.Get("state") state := query.Get("state")
fmt.Println(state)
usagePointId := query.Get("usage_point_id") usagePointId := query.Get("usage_point_id")
fmt.Println(usagePointId)
code := query.Get("code") code := query.Get("code")
fmt.Println(code)
redir := "http://" + host + "?code=" + code + "?state="+ state +"&usage_point_id=" + usagePointId redir := "http://" + host + "?code=" + code + "?state="+ state +"&usage_point_id=" + usagePointId
fmt.Println(redir)
http.Redirect(w, r, redir, 302) http.Redirect(w, r, redir, 302)
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment