cmd/reqecho: utility to dump webhook requests

This commit is contained in:
Branden J Brown 2025-04-08 12:59:47 -04:00
parent 293031fe38
commit 716f0e528b

23
cmd/reqecho/main.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"net/http"
"net/http/httputil"
"os"
)
func main() {
http.ListenAndServe(":3369", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
b, err := httputil.DumpRequest(r, true)
fmt.Printf("%v\n%s\n\n", err, b)
f, err := os.Create("prev.txt")
if err != nil {
panic(err)
}
if _, err := f.Write(b); err != nil {
panic(err)
}
os.Exit(0)
}))
}