Created
January 21, 2019 19:43
-
-
Save KentaKudo/a03da1a4e0180f07fae9afed686104e9 to your computer and use it in GitHub Desktop.
Go Code Snippet: URL.Query()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func handler(w http.ResponseWriter, r *http.Request) { | |
queries := r.URL.Query() // Values = map[string][]string | |
for key, values := range queries { | |
for _, v := range values { | |
fmt.Fprintf(w, "key: %s, value: %s\n", key, v) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
References