Created
September 9, 2025 11:42
-
-
Save 42LM/3b12cf25f80aa2deb61602cb996480fb to your computer and use it in GitHub Desktop.
go post form
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| ) | |
| func main() { | |
| router := http.NewServeMux() | |
| router.Handle("POST /woo", http.HandlerFunc(woo)) | |
| http.ListenAndServe(":8080", router) | |
| } | |
| func woo(w http.ResponseWriter, r *http.Request) { | |
| _ = r.ParseForm() | |
| form := r.PostForm | |
| fmt.Println(form["b"]) | |
| w.Write([]byte("WOO")) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment