Skip to content

Instantly share code, notes, and snippets.

@42LM
Created September 9, 2025 11:42
Show Gist options
  • Select an option

  • Save 42LM/3b12cf25f80aa2deb61602cb996480fb to your computer and use it in GitHub Desktop.

Select an option

Save 42LM/3b12cf25f80aa2deb61602cb996480fb to your computer and use it in GitHub Desktop.
go post form
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